How do i write PHP/MYSQL Code to search on the first value of a database field that is stored as a csv list?

Question by azkiz2001: How do i write PHP/MYSQL Code to search on the first value of a database field that is stored as a csv list?
I have a table – Product.

Product.Keywords is a csv list of entries. I want to be able to pull out all of the Product records whose first entry in that field matches the first entry in the field of the Product record I currently have available.

IE keyword of my product is (say) “fish, chips, peas”. I want all the products whose first keyword is “fish” but excluding my original product.

Best answer:

Answer by Big D
LIKE ‘fish%’

Know better? Leave your own answer in the comments!

No related content found.

Revisions

There are no revisions for this post.

Tags: , , , , , , , , ,

No comments yet.

Leave a Reply