基於種姓,宗教,地理位置,性別,年齡我需要從我的數據庫中過濾數據,我該怎麼做。搜索mysql數據庫使用更多的關鍵字使用php
在mysql數據庫中我有宗教,性別,地點,年齡作爲單獨的列在同一個表中。
代碼,我已經使用
$result=mysql_query("SELECT * FROM enquiry where location like '%$text%'and gender like'%$text1%' ")
or die("error");
$found=mysql_num_rows($result);
if($found>0){
while($row=mysql_fetch_array($result)){
//display of data
}
使用這個我可以使用一個關鍵字一個欄搜索數據...因爲我是新的,請給我上懸而未決這個使用PHP正確的方式。
''或者其他像'%$ text%'這樣的列怎麼樣? – geomagas
我不明白你的問題... –
or ...'location REGEXP「text1 | text2 | text3」'或'location in('text1','text2','text3')' –