Welcome Guest, Not a member yet? Register   Sign In
Commands out of sync; you can't run this command now
#3

OK, so I've tried everything in https://dev.mysql.com/doc/refman/8.0/en/...-sync.html (see above) but maybe I'm not calling those commands correctly? I've tried:

$result = $this->db->store_result();
$this->db->free_result();

also tried:
if ($result = $this->mysqli->store_result())
{
while ($row = $result->fetch_assoc())
{
$this->Data[$i][] = $row;
}
//mysqli_free_result($result); this didn't do anything
$this->mysqli->free_result($result) //this didn't either
}

also tried calling this after each query:
public function clearStoredResults(){
$db_id = $this->db->conn_id;
do {
if ($res = $this->db->call_function("store_result", $db_id)) {
$res->free();
}
} while ($this->db->call_function("more_results", $db_id) && $this->db->call_function("next_result", $db_id));
}

Also tried updating the _execute code in this system folder according to: https://stackoverflow.com/questions/3632...sync-error

Also tried after each query:
$this->free_result();

function free_result() {
while (mysqli_more_results($this->conn) && mysqli_next_result($this->conn)) {

$dummyResult = mysqli_use_result($this->conn);

if ($dummyResult instanceof mysqli_result) {
mysqli_free_result($this->conn);
}
}
}

Still no luck. Now I'm not even getting an error message, I just get my messages I've added myself using log_message. I get successfully logged messages after every line, up until I try to get a result using: $result=$this->db->get('tblProgram')->result(); Then the logs are blank and I eventually get a 500 Server Error (sometimes I then get repeated 500 server errors for minutes after trying to refresh the page)

I've also tried just writing out my query to the console, and not getting results using $result=$this->db->get('tblProgram')->result(); to make sure the query is correct. The query is coming back as a successful query I can run on the database.

Any other suggestions?
Reply


Messages In This Thread
RE: Commands out of sync; you can't run this command now - by xanabobana - 11-22-2022, 12:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB