0

I am trying to load multiple categories from Mysql , can this code be improved?

> $category=''; 

$search_for_categories_on_service = mysql_query("SELECT * FROM service WHERE mid='$m_id' AND online='1'"); 

while($cat_search_row = mysql_fetch_array($search_for_categories_on_service)){ 

$search_cat_query = $cat_search_row['category'];
$category .=" OR category LIKE '%$search_cat_query%' ";

}



$construct = mysql_query("SELECT * FROM request_service WHERE id  AND category = 'none' $category AND online='1'"); 
  • For a start, stop using mysql_ functions http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php – rjdown Oct 25 '15 at 00:21
  • To make it easier for answerers, or others with similar problems, please [edit] to add a specific problem statement — "it doesn't work" can be assumed, but *how* does it not work? What error message or incorrect behavior is characteristic? If you're just looking for general advice on possible improvements to make, [Code Review](http://codereview.stackexchange.com/help/how-to-ask) is where it's at. – Nathan Tuggy Oct 25 '15 at 00:54

0 Answers0