MySQL - Please help
#1

Hello.

For loading player data, I'm using this:



Код:
mysql_real_escape_string(inputtext, EscPass);
 
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = md5('%s')", pName(playerid), EscPass);
 
mysql_query(Query);
mysql_store_result();


stock savePlayer(playerid)
{
    	if(mysql_fetch_row(Query))
        {
 			 	sscanf(Query, "e<p<|>s[32]dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfffddddffddddddddddddddddddddddddddddddddddddddddddddddddds[32]ds[32]ds[32]ds[32]ds[32]dddddddddddddddddddddddddddddd>", PlayerInfo[playerid]);
                mysql_free_result();
        }
}
That is pretty useful because I don't need to write all the playerinfo variables, it includes all..


How can I do something simillar to save player data?


Thank's.
Reply
#2

"UPDATE db SET (row1,row2,row3) VALUES (0,0,0) WHERE nick = '%s'"


hope i helped you
Reply
#3

To put the values variables I will need to put more than 100 variables..

Can't I do something like the loadPlayer?? (Put PlayerInfo[playerid] instead of put the all variables (PlayerInfo[playerid][xxx], PlayerInfo[playerid][xxa], PlayerInfo[playerid][xxb]), etc...)
Reply
#4

i dont think so
Reply
#5

Other people help please.


Quote:

Can't I do something like the loadPlayer?? (Put PlayerInfo[playerid] instead of put the all variables (PlayerInfo[playerid][xxx], PlayerInfo[playerid][xxa], PlayerInfo[playerid][xxb]), etc...)

Reply
#6

Unless you want to loop through PlayerInfo and format a string/execute a query 100 or more times, then no, you can't do it.
Reply
#7

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Unless you want to loop through PlayerInfo and format a string/execute a query 100 or more times, then no, you can't do it.
Would it lag the server?
Reply
#8

Please help!
Reply
#9

heeeeellpp meeeee
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)