Mysql problem
#1

i added this in my code
pawn Код:
mysql_query("SELECT * FROM accounts");
    mysql_fetch_field_row( "HouseID",query);
    PlayerData[playerid][HouseID] = strval(query);
    format(query,sizeof(query),"UPDATE Houses SET Owner = 'No Owner' WHERE ID = %d",PlayerData[playerid][HouseID]);
    mysql_query(query);
    format(query,sizeof(query),"UPDATE Houses SET HasOwner = 0 WHERE ID = %d",PlayerData[playerid][HouseID]);
    mysql_query(query);
but on my debug i got this

Код:
[11:41:42] CMySQLHandler::Query(UPDATE Houses SET Owner = 'No Owner' WHERE ID = 0) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
[11:41:42] >> mysql_query( Connection handle: 1 )

[11:41:42] CMySQLHandler::Query(UPDATE Houses SET HasOwner = 0 WHERE ID = 0) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)

[11:41:42] >> mysql_query( Connection handle: 1 )
My HouseID was 28 on phpmyadmin
Reply
#2

Not sure but you might need to free the result before running more queries. Your first query returns every piece of data in the accounts table.
Reply
#3

I did the thing you said above but for some reason i get 0 as my ID
Код:
1:54:13] CMySQLHandler::Query(UPDATE Houses SET Owner = 'No Owner' WHERE ID = 0) - Successfully executed.
[11:54:13] >> mysql_query( Connection handle: 1 )

[11:54:13] CMySQLHandler::Query(UPDATE Houses SET HasOwner = 0 WHERE ID = 0) - Successfully executed.
Reply
#4

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)