Skip navigation links

MySQL Forums :: PHP :: Commands out of sync; you can't run this command now


Advanced Search

Commands out of sync; you can't run this command now
Posted by: Jason Wisdom ()
Date: January 20, 2008 04:44PM

Help!

I am creating a new website with PHP and MySQL 5.
It has been working alright, with dynamic SQL statements (shared hosting service blocked stored procs & triggers...fascists).

Now I am porting to a VPS and I am writing Stored Procs. The first one runs fine, but the second one on any page gives me the "Commands out of sync; you can't run this command now" error.

What gives? Here is a very simple re-creation of my code:

---------------------------------------

<html><body>
<?php
$conn = mysql_pconnect( "localhost", "uid", "pwd", 65536 ) or die( "Failed to connect to MySQL server" );

mysql_select_db( "mydb", $conn ) or die( "Could not select test database" );

// Run 1.
$result = mysql_query( "CALL spSelectRows()" )
or die( mysql_error() );

if($result)
{echo "TRUE<br />";}

// Run 2.
$result = mysql_query( "CALL spSelectRows()" )
or die( mysql_error() );

if($result)
{echo "TRUE <br />";}

$rows = mysql_num_rows( $result );
echo "Rows=$rows<br />";
?>
</body></html>


----------------------------------------------

Here is what I see on the page:

TRUE
Commands out of sync; you can't run this command now

---------------------------------------------

I SHOULD see "TRUE" "TRUE" "16" (or however many records are returned).

Why am I getting this error?

Thanks much.
Jason

Options: ReplyQuote


Subject Written By Posted
Commands out of sync; you can't run this command now Jason Wisdom 01/20/2008 04:44PM
Re: Commands out of sync; you can't run this command now Jason Wisdom 01/20/2008 08:48PM
Re: Commands out of sync; you can't run this command now william bao 07/09/2008 10:04PM
Re: Commands out of sync; you can't run this command now Peter Brawley 07/10/2008 11:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.