Jump to content

mysql select query help


MDanz

Recommended Posts

for example.. in one column it has "test1, test2, test3, test4"  .... when i search for test1... i only want rows that have 'test1' in them. 

 

$search = test1

 

i've tried LIKE %$test1% but it get's all rows with the word 'test' in it... i want only rows with the word 'test1' in it.

Link to comment
Share on other sites

i used LIKE $search% and it worked.  thanks anyway

 

Double check that. If you search for test2 in your query, you won't return correct results. It only returns the right results if you use the first term with your query. I just created a table and tried it. You need a % in front too, like I originally suggested

 

i've tried LIKE %$test1% but it get's all rows with the word 'test' in it... i want only rows with the word 'test1' in it.

 

No, that should return the right results: anything with test1 in it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.