Basically this is what I am doing:
- Code: Select all
$stateStmt->bind_param('i',$repID);
if($stateStmt->execute()){
$stateStmt->bind_result($currentState);
while($stateStmt->fetch()){
$stateUsed = false; //flag since we only echo out the state once
$arg3 = $currentState . "%";
//pull a list of cities for the current state
$cityStmt->bind_param('is',$repID,$arg3);
if($cityStmt->execute()){
$cityStmt->bind_result($igcode,$currentCity);
while($cityStmt->fetch()){
$cityUsed = false; //flag since we only echo out the city once.
The $stateStmt query and loop execute correctly. As soon as I go to execute the second statement "$cityStmt->execute()" I get a "Commands out of Sync" error.

