Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

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

Asked by Bruce Benedict Mar 20, 2023 1.3K views 1 answer
Share

About this question

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?

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.