recomendation save account mysql
#1

Hello
I have two questions

when saving an account OnPlayerDisconnect,
It is better to use mysql_function_query or mysql_query?

I've never used this
PHP Code:
public SavePlayer(playerid)
{
    new 
query[100];
    
mysql_format(dbquerysizeof(query), "UPDATE `players` SET money = %d, score = %d WHERE `nick` = '%e'"Money[playerid], Score[playerid], name(playerid));
    
mysql_query(dbqueryfalse);
    return 
1;

OR

I have always used this way, okay well?
PHP Code:
public SavePlayer(playerid)
{
    new 
query[100];
    
mysql_format(dbquerysizeof(query), "UPDATE `players` SET money = %d, score = %d WHERE `nick` = '%e'"Money[playerid], Score[playerid], name(playerid));
    
mysql_function_query(dbqueryfalse"""");
    return 
1;

other question:
rarely (almost never), some players lose their statistics.
It happens 1 time in 10000 so to speak, this only happens with statistics that are saved when the player is disconnected, for example score, money, etc.

PHP Code:
new query[100];
mysql_format(dbquerysizeof(query), "UPDATE `players` SET money = %d, score = %d WHERE `nick` = '%e'"Money[playerid], Score[playerid], name(playerid));
mysql_function_query(dbqueryfalse""""); 
thanks
Reply
#2

1) Always use threaded queries.
2) The only reason I can think of it happen is if the query isn't executed in OnPlayerDisconnect and it is delayed which the variables eventually get reset.
Reply
#3

thanks for answering

which of the two functions would be threaded?
Reply
#4

Neither. mysql_tquery is the function for threaded queries.
Reply
#5

mysql_function_query is not the same as mysql_tquery?
Reply
#6

mysql_function_query was a macro for mysql_tquery in R33+ versions.
Reply
#7

Quote:
Originally Posted by Konstantinos
View Post
1) Always use threaded queries.
Why? It is gonna work without threaded query too.
Reply
#8

Quote:
Originally Posted by Rdx
View Post
Why? It is gonna work without threaded query too.
Sure it will but the question was which one (non-threaded queries vs threaded queries) is better and the answer is obvious as we all know.
Reply
#9

you could suggest something to avoid the problem of losing OnPlayerDisconnect statistics?
I would thank you a lot
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)