Reputation: 155
Slightly odd one this and any help would be appreciated.
$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);
This returns an error
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
It's not the first time I've used multiple parameters but is the first time I've had to use the same variable against both parameter slots.
It's probably a simple schoolboy error but I can't see it.
Thanks
Upvotes: 0
Views: 13