Page 1 of 1

can i use wild cards in a select statment [SOLVED]

Posted: Tue Feb 10, 2004 4:22 am
by nutstretch
I have a field in my database which holds values seperated by ,'s
for example: 3,4,4.5,5,6,7.5

I want the user to chose a value from a list and see if that value is held in the field. for example 4.5

Can i use a wild card expression. I tried this but it returned nothing

$resultID = mysql_query("SELECT * FROM tblShoestest where fitting LIKE '$width' AND SizeRange1 LIKE '*$size*'", $linkID)or die(mysql_error());

any help appreciated

Posted: Tue Feb 10, 2004 4:30 am
by malcolmboston

Posted: Tue Feb 10, 2004 4:30 am
by JayBird
for wildcards, use percentage signs instead of asterix

Code: Select all

$resultID = mysql_query("SELECT * FROM tblShoestest where fitting LIKE '$width' AND SizeRange1 LIKE '%$size%'", $linkID)or die(mysql_error());
Mark

Posted: Tue Feb 10, 2004 4:35 am
by nutstretch
Many thanks Bech100