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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.