Jump to content

[SOLVED] mysql query find value in a field


jesushax

Recommended Posts

hi all

 

what im tryign to do is, find a value in a field to return results by eg

 

mysql_query("SELECT 8 * FROM tblDirectory WHERE Sect1_2='Has the value Architects inside it'") or die(mysql_error());

 

the field Sect1_2 has values delimited by commas "Architects, Builders, Joiners, Plumbers,"

 

so i would like to be able to return all results that have the word Architects in

 

how would i do that?

 

Thanks

It's all down to the % sign:

 

LIKE'%Architects%'

    will match if the word 'Architects' appears anywhere in the field

LIKE'Architects%'

    will match if the word 'Architects' appears at the very beginning of the field

LIKE'%Architects'

    will match if the word 'Architects' appears at the very end of the field

 

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.