SA-MP Forums Archive
MySQL BlueG Update - 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 BlueG Update (/showthread.php?tid=664412)



MySQL BlueG Update - KamilPolska - 28.02.2019

Is this how can update all players? Do need to code differently?
Код:
new query[100];

mysql_format(g_SQL, query, sizeof(query), "UPDATE `players` SET `number` = %d WHERE `id` = %d LIMIT 1", pInfo[playerid][pNumber], pInfo[playerid][pID]);
mysql_tquery(g_SQL, query);



Re: MySQL BlueG Update - polygxn - 28.02.2019

You need to loop through all the online players if you want to save their data one by one. But saving a large amount of data at once is not really efficient in my opinion.


Re: MySQL BlueG Update - TheToretto - 28.02.2019

Quote:
Originally Posted by polygxn
Посмотреть сообщение
You need to loop through all the online players if you want to save their data one by one. But saving a large amount of data at once is not really efficient in my opinion.
The author did not specify, connected or not, so to update all players' data with one query, you can remove the WHERE clause, it will then affect changes to all "users" table's specified column.

If you want it still with one query and to affect every online player, add a boolean value that changes when a player logs in successfully, and put it back to false when the player disconnects, then obviously just check whether the player's column is set to true or not.