Number of bind variables doesn't match number of fields...
Posted: Tue May 05, 2009 10:32 am
Hi, I get the following error message:
thanks
why ?Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn't match number of fields in prepared statement in /Users/aneuryzma/Sites/login_submit.php on line 65
thanks
Code: Select all
$db = mysqli_connect('127.0.0.1', 'root', '98898989') or die("Could not connect: " . mysqli_error());
mysqli_select_db($db, "phpro_auth");
/*** prepare the select statement ***/
//$stmt = $dbh->prepare("SELECT phpro_user_id, phpro_username, phpro_password FROM phpro_users
// WHERE phpro_username = :phpro_username AND phpro_password = :phpro_password");
$sql = "SELECT phpro_user_id, phpro_username, phpro_password FROM phpro_users WHERE phpro_username = ? AND phpro_password = ?";
$stmt = $db->stmt_init( );
if ($stmt->prepare($sql)) {
// Associate placeholders with data type and variable name
$stmt->bind_param('ss', $phpro_username, $phpro_password);
// Bind result variables
$stmt->bind_result($user_id);
// Execute prepared statement
$stmt->execute( );