我想使用phpmysql進行全文搜索,但它在mysql_num_rows中顯示錯誤,你能告訴我什麼是error.i創建的全文索引和更改表引擎也。麻煩全文搜索腳本在mysql
$search=mysql_real_escape_string($_POST['name']);
$sql="SELECT * FROM article WHERE MATCH(title, comment) AGAINST ('.$search.')";
$query = mysql_query($sql);
//Check if any results were returned
if(mysql_num_rows($query)>0){
//If so, cycle through the results
while($link = mysql_fetch_array($query)){
echo("<big><big><a href=show.php?id=$link[id] class=y>$link[title]</a></big></big> <br>");
echo('<big>' . $link['comment'] . '</big><br><br>');
//End the while
}}
你能複製並粘貼你收到的錯誤嗎? – Zomxilla
警告:mysql_num_rows()期望參數1是資源,在第61行的C:\ wamp \ www \ Include \ searchphp.php中給出的布爾值,這是它顯示的錯誤 – test
是否需要$ search引號?使用雙引號通常意味着你不需要這些。我習慣於使用像Codeigniter這樣的框架或我自己的類,所以我不能100%確定會影響結果。 – Zomxilla