Mysql problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql problem (
/showthread.php?tid=334327)
Mysql problem -
Tanush123 - 14.04.2012
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
Re: Mysql problem -
iggy1 - 14.04.2012
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.
Re: Mysql problem -
Tanush123 - 14.04.2012
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.
Re: Mysql problem -
Tanush123 - 15.04.2012
bump