Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

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

have looked through the forums already but have been unable to solve this problem: Commands out of sync; you can't run this command now SQL

My query is:

SELECT Car.*, Building.*, CarType.* 
FROM Car 
INNER JOIN Building 
ON Car.BuildingID=Building.BuildingID 
INNER JOIN CarType 
ON Car.CarType=CarType.TypeID 
WHERE Car.CarID <> (SELECT CarID FROM Requests WHERE Status = 'Accepted')

Any help appreciated. thank you

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

REFER Documentation Here

If you get Commands out of sync; you can't run this command now in your client code, you are calling client functions in the wrong order.

This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without calling mysql_use_result() or mysql_store_result() in between.

You need to use/store result before you can proceed with next query after.

Another alternative is to close the connection and starts it again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...