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

Discussion in 'MySQL' started by grutland, May 9, 2010.

  1. #1
    I've been trying to fix this or find a way round this with out disconnecting from the DB completely and re-connecting, but I'm having some real troubles with this error.

    My function to run SQL is as follows...
    (It's a function inside a class of mine)
    if($objRecordset = $this->_DB->query($strSQL)){
    	ShowDebug("Recordset = ". gettype($objRecordset));	
    	if(is_object($objRecordset)){
    		if($objRecordset->num_rows > 0){
    			$i = 0;
    			while($row = $objRecordset->fetch_assoc()){
    				foreach($row as $field => $value){
                		$objRS[$i][$field] = stripslashes($value);
                	}
                	$i++;
                }
    		}					
    	}
    	$objRecordset->close();
    }
    PHP:
    Even though I'm closing the recordset, I'm still getting the same error.
    Is there any thing obvious I'm not doing?

    I really don't want to have to disconnect from the DB completely.
     
    grutland, May 9, 2010 IP