如何从字符串加载多个关键字?

时间:2015-10-25 00:15:54

标签: php mysql search categories

我正在尝试从Mysql加载多个类别,这段代码可以改进吗?

> $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'"); 

0 个答案:

没有答案