Jump to content

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


FraggleRock

Recommended Posts

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>';

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.