SA-MP Forums Archive
[Help] MySQL String formatting for query. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] MySQL String formatting for query. (/showthread.php?tid=164594)



[Help] MySQL String formatting for query. - Ace_Menace - 01.08.2010

Alright then, first off thanks for your interest.
I'm a newb at MySQL.. -.-, and could use some help with the following:

pawn Код:
error 075: input line too long (after substitutions)
Pretty sure it has to with the array size but for the life of me I can't seem to fix it.
pawn Код:
new string[256];
/*Error here*/  format(string, sizeof(string), "UPDATE Users SET Password='%s',AdminLevel='%d',Cash='%d',Regged='%d',Level='%d',Kills='%d',Locked='%d',Int='%d',Local='%d',Mats='%d',MiserPerk='%d',Deaths='%d',IP='%s' WHERE Name='%s'", PlayerShit[playerid][PLAYER_PASS], PlayerShit[playerid][PLAYER_ADMINLEVEL], PlayerShit[playerid][PLAYER_CASH], PlayerShit[playerid][PLAYER_REGGED], PlayerShit[playerid][PLAYER_LEVEL], PlayerShit[playerid][PLAYER_KILLS], PlayerShit[playerid][PLAYER_LOCKED], PlayerShit[playerid][PLAYER_INT], PlayerShit[playerid][PLAYER_LOCAL], PlayerShit[playerid][PLAYER_MATS], PlayerShit[playerid][PLAYER_MISERPERK], PlayerShit[playerid][PLAYER_DEATHS], PlayerShit[playerid][PLAYER_IP], PlayerShit[playerid][PLAYER_NAME]);
    mysql_query(string);
    return 1;



Re: [Help] MySQL String formatting for query. - Calgon - 01.08.2010

Instead of reading your query, you could tell us what you need help with. I don't plan on wasting my time reading 256 characters due to your poor explanation.


Re: [Help] MySQL String formatting for query. - Ace_Menace - 01.08.2010

Sorry, just flew over my head.

pawn Код:
error 075: input line too long (after substitutions)
This is on the formatting line.


Re: [Help] MySQL String formatting for query. - Ace_Menace - 01.08.2010

Fixed the issue:

pawn Код:
new string[256];
    format(string, sizeof(string), "UPDATE Users SET Password='%s',AdminLevel='%d',Cash='%d',Regged='%d',Level='%d',Kills='%d',Locked='%d',Int='%d',Local='%d',Mats='%d',MiserPerk='%d',Deaths='%d',IP='%s' WHERE Name='%s'",
    PlayerShit[playerid][PLAYER_PASS], PlayerShit[playerid][PLAYER_ADMINLEVEL], PlayerShit[playerid][PLAYER_CASH], PlayerShit[playerid][PLAYER_REGGED], PlayerShit[playerid][PLAYER_LEVEL], PlayerShit[playerid][PLAYER_KILLS], PlayerShit[playerid][PLAYER_LOCKED], PlayerShit[playerid][PLAYER_INT], PlayerShit[playerid][PLAYER_LOCAL], PlayerShit[playerid][PLAYER_MATS], PlayerShit[playerid][PLAYER_MISERPERK], PlayerShit[playerid][PLAYER_DEATHS], PlayerShit[playerid][PLAYER_IP], PlayerShit[playerid][PLAYER_NAME]);
    mysql_query(string);
    return 1;