SA-MP Forums Archive
Saving MySQL account; too long. - 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: Saving MySQL account; too long. (/showthread.php?tid=450187)



Saving MySQL account; too long. - Darnell - 12.07.2013

I use this
pawn Код:
format(s_Query,sizeof(s_Query),"UPDATE `accounts` SET sLevel='%d',sMoney='%d',sBank='%d',sSkin='%d', sIP ='%s', sX='%f',sY='%f',sZ='%f',sA='%f',sInterior='%d',sVw='%d', WHERE suser='%s'",PlayerInfo[playerid][sLevel],PlayerInfo[playerid][sMoney],PlayerInfo[playerid][sBank],PlayerInfo[playerid][sSkin],PlayerInfo[playerid][sIP],PlayerInfo[playerid][sPos][0],PlayerInfo[playerid][sPos][1],PlayerInfo[playerid][sPos][2],PlayerInfo[playerid][sPos][3],PlayerInfo[playerid][sInterior],PlayerInfo[playerid][sVw],PlayerName);
But it's too long, how can I shorten it?


Re: Saving MySQL account; too long. - Isolated - 12.07.2013

I used strcat for mine. Clicckkky

If you need any more help, just ask

EDIT:

When I did mine, I did it like:

pawn Код:
new str[128], str2[128];
format(str, sizeof(str), "UPDATE Users "); strcat(str, str2);
for every param.


Re: Saving MySQL account; too long. - Djole1337 - 12.07.2013

pawn Код:
new
    szStr[128];
strcat(szStr, "You can ");
format(szStr, sizeof(szStr), "%sdo this too", szStr);



Re: Saving MySQL account; too long. - CrazyChoco - 12.07.2013

Код:
new str[128];
format(str, sizeof(str), "Something here \
And something here");



Re: Saving MySQL account; too long. - Jessyy - 12.07.2013

Quote:
Originally Posted by Darnell
Посмотреть сообщение
But it's too long, how can I shorten it?
you can not...


Re: Saving MySQL account; too long. - Darnell - 12.07.2013

Can you give me a big example? Like, saving the user, password and the kills, I'll continue from there.


Re: Saving MySQL account; too long. - CrazyChoco - 12.07.2013

Quote:
Originally Posted by Darnell
Посмотреть сообщение
Can you give me a big example? Like, saving the user, password and the kills, I'll continue from there.
pawn Код:
format(s_Query,sizeof(s_Query),"UPDATE `accounts` SET sLevel='%d',sMoney='%d',sBank='%d',sSkin='%d',\
sIP ='%s', sX='%f',sY='%f',sZ='%f',sA='%f',sInterior='%d',sVw='%d', WHERE suser='%s'"
,PlayerInfo[playerid][sLevel],PlayerInfo[playerid][sMoney],PlayerInfo[playerid][sBank],PlayerInfo[playerid][sSkin],PlayerInfo[playerid]sIP],
PlayerInfo[playerid][sPos][0],PlayerInfo[playerid][sPos][1],PlayerInfo[playerid][sPos][2],PlayerInfo[playerid][sPos][3],PlayerInfo[playerid][sInterior],PlayerInfo[playerid][sVw],PlayerName);
You could do it by adding the "backslash.


Re: Saving MySQL account; too long. - Darnell - 12.07.2013

Less stupid query?


Re: Saving MySQL account; too long. - kristo - 12.07.2013

Код:
new string[512], string2[128];
format(string, sizeof(string), "UPDATE asd = %i, abc = '%s', agh = '%f', ", a, b, c); // In the end of the first or in the beginning of the second line must be a space.
format(string2, sizeof(string2), "ghj = %i, gsg = %i, ", d, e);
strcat(string, string2);
format(string2, sizeof(string2), "yue = '%s' WHERE agn = %i", f, g);
strcat(string, string2);
It may have some typos in it.