adammc
08-25-2006, 06:44 AM
Hi guys,
I have used the following code during a MYSQL INSERT
// Format the categories variable, make them seperated by a comma
if (is_array($categories))
{
$categories_new = implode(", " , $categories);
}
For example: the categories column contains data like this:
Brakes
Brakes, Clutches, Wheels, Windscreens
Windscreens
I am trying to search my table for any entries that for example contain 'Brakes'. This should return 2 results based oin the example above.
Only problem is my code isnt working, I am guessing because its not going through the comma deliminatede list. (getting to the first entry and stopping there.
Do I have to explode it before I can search it?
$query2 = "select * FROM postings WHERE vehicle_make = '$row[vehicle_model]' AND category LIKE '$row[vehicle_model]' ";
I have used the following code during a MYSQL INSERT
// Format the categories variable, make them seperated by a comma
if (is_array($categories))
{
$categories_new = implode(", " , $categories);
}
For example: the categories column contains data like this:
Brakes
Brakes, Clutches, Wheels, Windscreens
Windscreens
I am trying to search my table for any entries that for example contain 'Brakes'. This should return 2 results based oin the example above.
Only problem is my code isnt working, I am guessing because its not going through the comma deliminatede list. (getting to the first entry and stopping there.
Do I have to explode it before I can search it?
$query2 = "select * FROM postings WHERE vehicle_make = '$row[vehicle_model]' AND category LIKE '$row[vehicle_model]' ";