Error ID: 2014, Commands out of sync; you can't run this command now
#8

Quote:
Originally Posted by Rachael
View Post
did you forget mysql_store_result()?
Yes, thanks!

pawn Code:
stock OfflineMessage(cid, text[])
{
   
    format(string, sizeof(string), "INSERT INTO offline_messages (Message, CharacterID) VALUES('%s', '%i')", text, cid);
    mysql_query(string);
    mysql_query("SELECT MAX(SQLID) FROM offline_messages");
   
    new onlineplayer = IsOnline(cid);
   
    if(onlineplayer != INVALID_PLAYER_ID)
    {
       SendClientMessage(onlineplayer, SERVER_COLOR, "SERVER: You have received a new message, /messages to read it.");
    }

}
Everything after this function use starts to bug, i mean showing command out of sync error.

pawn Code:
[15:47:53] CMySQLHandler::Query(INSERT INTO offline_messages (Message, CharacterID) VALUES('Lol', '62')) - Successfully executed.

[15:47:53] >> mysql_query( Connection handle: 1 )

//use of the function
[15:47:53] CMySQLHandler::Query(SELECT MAX(SQLID) FROM offline_messages) - Successfully executed.

[15:47:54] >> mysql_query( Connection handle: 1 )

// and here it shows the sync error
[15:47:54] CMySQLHandler::Query(SELECT `CharacterName` FROM characters WHERE cSQLID = '62') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)

[15:47:54] >> mysql_store_result( Connection handle: 1 )

[15:47:54] CMySQLHandler::StoreResult() - Result was stored.

[15:47:54] >> mysql_fetch_row_format( Connection handle: 1 )

[15:47:54] CMySQLHandler::FetchRow() - Return: 29

[15:47:54] >> mysql_free_result( Connection handle: 1 )

[15:47:54] CMySQLHandler::FreeResult() - Result was successfully free'
d.
Look in comments!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)