This is question, however:
In a PHP file, I am running an ezSql command (http://justinvincent.com/ezsql):
$_result = $db->get_var("CALL spcheck ('".$_var1."')");
then I have a if ($_result..
within that if, I have:
$_logInsert = $db->query("CALL splog1 ('".$_referrer."','".$_userAgent."','".$_ipAddress."','".$_countryCode."')");
However, I get the error:
"Warning: Commands out of sync; you can't run this command now" when I try the second db call (first one runs fine)
Is it not possible to have a globally defined $db and use it throughout the page multiple times? Do I need to somehow "cancel
the get_var after its executed so I can reuse it?
After a quick Google and a peak under the hood of ezSQL.
In ez_sql_mysql.php (or whatever name you may have given the file) Line 81 (as at v2.11)
Old code:
else if ( ! $this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword,true) )
New code:
else if ( ! $this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword,true,131074) )
Adapted from Drupal Bugs - "Patch needed to execute MySQL stored procedures"