What to do in case of commands out of sync; you can't run this command now?

336    Asked by bruce_8968 in SQL Server , Asked on Mar 20, 2023

I have a query which was working fine a few days back:

SELECT
    id, title, details, filetype, filepath, size, details, location, datetime, 
    IF(hid=1, 'Anonymous',
        (
            SELECT name 
            FROM users 
            WHERE did = userid
        ))
    AS username 
FROM infotable 
WHERE ext2!='0' 
ORDER BY id DESC 
LIMIT 50

but a couple of days back, it started giving an error:

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

I am calling it from a PHP page but I have also tried it from MySQL's GUI to run it as SQL query. It gave the the same error:

When I googled, I found that it may be due to MySQL to MySQLi update. I tried a lot to write an alternate query using MySQLi, but every time I got an error (Some times the same error and some times other errors).

My questions are:


1. What this can be called as: Sub Query or Multi Query

2. What is the exact error and what is its solution?

Answered by David Edmunds

In case of commands out of sync; you can't run this command now- Running CHECK on the table showed it had errors and had crashed. Running REPAIR on the table fix the errors and I stopped getting the "Commands out of Sync" error on my own query.



Your Answer

Interviews

Parent Categories