FraggleRock Posted May 22, 2010 Share Posted May 22, 2010 Evening everyone. When I run the PHP code at the bottom, I get an error of: Commands out of sync; you can't run this command now The error occurs between the first and 2nd calls to the database for the proc call Cat_Display. I also get the same message if I remove the 2nd Cat_Display proc call and use the AccessTypes_Display proc call. anyone have any thoughts on why this is occurring and how to stop it. I appreciate the assistance. Fraggle <?php include_once('mysqli_connect.php'); $CategoryQuery = "Call Cat_Display"; $RatingQuery = "Call Rating_Display"; $StepTypeQuery = "CALL StepTypes_Display"; $AccessTypesQuery = "CALL AccessTypes_Display"; echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Recipe Insert</title> </head> <body> <form method="post" action="saveTheData.php"> Title: <input type="text" size="80" maxlength="250" name="Title"> Servings: <input type="text" size="10" maxlength="10" name="Servings"<br>'; // drop down list for primary categories $CategoryResult = mysqli_query($dbc, $CategoryQuery) or die('Error: '.mysqli_error($dbc).' Query = '.$CategoryQuery); if ($CategoryResult) { echo 'Primary Category: <select name="CategoryID1">'; while($Cat = mysqli_fetch_array($CategoryResult, MYSQLI_NUM)) { echo "<option value=\"$Cat[0]\">$Cat[1]</option>"; } echo '</select>'; // free the results so we can run another query mysqli_free_result($CategoryResult); } // drop down list for secondary categories $CategoryResult = mysqli_query($dbc, $CategoryQuery) or die('Error: '.mysqli_error($dbc).' Query = '.$CategoryQuery); if ($CategoryResult) { echo 'Primary Category: <select name="CategoryID1">'; while($Cat = mysqli_fetch_array($CategoryResult, MYSQLI_NUM)) { echo "<option value=\"$Cat[0]\">$Cat[1]</option>"; } echo '</select>'; // free the results so we can run another query mysqli_free_result($CategoryResult); } // drop down list for Access Types $AccesstypeResult = mysqli_query($dbc, $AccessTypesQuery) or die('Error: '.mysqli_error($dbc).' Query = '.$AccessTypesQuery); if ($AccesstypeResult) { echo 'Primary Category: <select name="CategoryID1">'; while($AT = mysqli_fetch_array($accesstypeResult, MYSQLI_NUM)) { echo "<option value=\"$AT[0]\">$AT[1]</option>"; } echo '</select>'; // free the results so we can run another query mysqli_free_result($AccesstypeResult); } // finish the web page echo '<br><br><br></body></html>'; ?> Link to comment https://forums.phpfreaks.com/topic/202557-commands-out-of-sync-you-cant-run-this-command-now/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.