I'm getting this:
Warning: mysqli_stmt_bind_result() [function.mysqli-stmt-bind-result]: Number of bind variables doesn't match number of fields in prepared statement
I've defined $id and $link above this in my code, and have no trouble connecting to the database.
$query = "select * from tablename where id = ?";
if ($stmt = mysqli_prepare($link, $query)) {
mysqli_stmt_bind_param($stmt, 'i', $id);
//execute statement
mysqli_stmt_execute($stmt);
// bind result variables
mysqli_stmt_bind_result($stmt, $first, $last);
// fetch values
mysqli_stmt_fetch($stmt);
echo "$first $last<br>";
// close statement
mysqli_stmt_close($stmt);
}
It seems to me that the query only has one '?', so it should only need one (integer typed) value to fill in, which I think I'm supplying with $id. Help?