mysqli bind_param un-matched number of variables woes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I'm using PHP5/mysqli with object style bind_param,
which always reports "mysqli_stmt::bind_param() Number
of variables doesn't match number of parameters in
prepared statement" - even if they do match! - and
even using the sample code from the zend tutorial.

I have included the (slightly modified) zend code
below (I had to include a $mysqli->stmt_init() call
for it to work this far). All works well until the
$stmt->bind_param which causes the error.

I'm using PHP5/mysqli/MySQL4.1.3b-beta and WinXP

Does anybody have any thoughts/ideas?
Any help would be greatly appreciated.

regards

Jason

<?php 
$mysqli = new mysqli('localhost', 'xxx', 'xxx',
'world'); 

/* check connection */ 
if (mysqli_connect_errno()) { 
    printf("Connect failed: %s\n",
mysqli_connect_error()); 
    exit(); 
} 
$stmt = $mysqli->stmt_init();
$stmt->prepare("INSERT INTO CountryLanguage VALUES (?,
?, ?, ?)"); 
$stmt->bind_param('sssd', $code, $language, $official,
$percent); 

$code = 'DEU'; 
$language = 'Bavarian'; 
$official = "F"; 
$percent = 11.2; 

/* execute prepared statement */ 
$stmt->execute(); 

printf("%d Row inserted.\n", $stmt->affected_rows); 

/* close statement and connection */ 
$stmt->close(); 

/* Clean up table CountryLanguage */ 
$mysqli->query("DELETE FROM CountryLanguage WHERE
Language='Bavarian'"); 
printf("%d Row deleted.\n", $mysqli->affected_rows); 

/* close connection */ 
$mysqli->close(); 
?>



	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux