MySQL BlueG Update
#1

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);
Reply
#2

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.
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)