SA-MP Forums Archive
MySQL - Please help - 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 - Please help (/showthread.php?tid=329531)



MySQL - Please help - mikiii18 - 29.03.2012

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.


AW: MySQL - Please help - Tigerkiller - 29.03.2012

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


hope i helped you


Re: MySQL - Please help - mikiii18 - 29.03.2012

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


AW: MySQL - Please help - Tigerkiller - 29.03.2012

i dont think so


Re: MySQL - Please help - mikiii18 - 29.03.2012

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




Re: MySQL - Please help - SuperViper - 29.03.2012

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.


Re: MySQL - Please help - mikiii18 - 29.03.2012

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?


Re: MySQL - Please help - mikiii18 - 29.03.2012

Please help!


Re: MySQL - Please help - mikiii18 - 29.03.2012

heeeeellpp meeeee