PDA

View Full Version : MySQL Field Search Question.


nova912
07-16-06, 04:58 AM
Well I have a part of a form where it asks the user "what technology do you use" and it has 18 check boxes (sigh). So I thought I'll just mash them all together using a # or ! in between them like... "Apple iPod#Laptop Computer" then throw them in 1 field and not make 18 more columns. Now I'm woundering how do I search a field for "laptop" with out pulling every single field down using explode('#',$array['tech']) and throwing the matched in an array in php, how can i do it in the query :confused:


Thank you.

Nico
07-16-06, 06:02 AM
You could use % wildcard.


$query = "SELECT * FROM table WHERE tech LIKE '%Apple ipod%'";

nova912
07-16-06, 06:34 AM
You could use % wildcard.


$query = "SELECT * FROM table WHERE tech LIKE '%Apple ipod%'";



Of course, <bonks head>, Thank you.