对此有些奇怪,将不胜感激。
$rs_contact = mysqli_prepare($conn, "
SELECT CONTACTID, COMPANY, FORENAME, SURNAME, MATCH (FORENAME, SURNAME) AGAINST ('?') AS relevance
FROM CONTACTS
WHERE MATCH (FORENAME, SURNAME) AGAINST ('?')
ORDER BY relevance DESC
");
mysqli_stmt_bind_param($rs_contact, "ss", $q_string, $q_string);// bind parameters
mysqli_stmt_execute($rs_contact);// execute query
mysqli_stmt_store_result($rs_contact);// store result - needed for longtext fields
mysqli_stmt_bind_result($rs_contact, $CONTACTID, $COMPANY, $FORENAME, $SURNAME, $relevance);// bind result variables
$rowcount_contact = mysqli_stmt_num_rows($rs_contact);
这将返回错误
Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of variables doesn't match number of parameters in prepared statement in /search.php on line XX
这不是我第一次使用多个参数,而是我第一次必须对两个参数槽使用相同的变量。
这可能是一个简单的小学生错误,但我看不到。
谢谢