MYSQL 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MYSQL help (
/showthread.php?tid=174891)
MYSQL help -
vection - 07.09.2010
pawn Код:
format(Query, sizeof(Query), "INSERT INTO `playerinfo` (`user`, `password`, `level`, `admin`, `money`, bank) VALUES ('%s', '%s', 0, 0, 2000, 12000)", Pname, inputtext);
mysql_query(Query); //Queries
i got this line.
in MYSQL its a long line with 200 fields.
While player register its ok, because most of the fields getting "0". the problem starts when i want to load this.
i load it with sscanf:
pawn Код:
sscanf(line, "p|ssdddds", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data[2]);
Well, because i got 200 fields i cant load all of them because its error me "Too long ..."
how i can load them in other way?
Re: MYSQL help -
Vince - 07.09.2010
Try the sscanf plugin and use the enum function.
pawn Код:
sscanf(line, "e<p<|>ssddds>", PlayerInfo[playerid]);
That's it. Everything will be automatically assigned to the enum.
It does require every field in MySQL to be in the same order as the enum, though.
Re: MYSQL help -
vection - 07.09.2010
can you show me one line with enum? i dont get it ..
Re: MYSQL help -
vection - 07.09.2010
Any solution ?
Re: MYSQL help -
vection - 07.09.2010
upppppppp
Re: MYSQL help -
vection - 07.09.2010
pawn Код:
new line[750];
new data[3][50]; //The data strings
new data2[204]; //The data variables
sscanf(line, "p|ssddddddddddddsddddddddddddddddddddddddddddddddddddddffdddddddddddddddddddddddddddddddddddddddddsssssdffffdffffdffffddffffffffdfffffffffffffffdddsssssffffdddddddddddddddddddddddddddddddddddddddddddddddddds"); //Splits the line with sscanf
format(line, 32, PlayerInfo[playerid][pKey], data[1]);
format(line, 32, PlayerInfo[playerid][pLevel], data2[0]);
format(line, 32, PlayerInfo[playerid][pAdmin], data2[1]);
format(line, 32, PlayerInfo[playerid][pDonateRank], data2[2]);
format(line, 32, PlayerInfo[playerid][pConnectTime], data2[3]);
format(line, 32, PlayerInfo[playerid][pSex], data2[4]);
format(line, 32, PlayerInfo[playerid][pAge], data2[5]);
format(line, 32, PlayerInfo[playerid][pCK], data2[6]);
format(line, 32, PlayerInfo[playerid][pMuted], data2[7]);
format(line, 32, PlayerInfo[playerid][pExp], data2[8]);
format(line, 32, PlayerInfo[playerid][pCash], data2[9]);
format(line, 32, PlayerInfo[playerid][pBan], data2[10]);
format(line, 32, PlayerInfo[playerid][pReason], data2[11]);
format(line, 32, PlayerInfo[playerid][pAccount], data2[12]);
Tried to do somthing like that.. still doesnt work well..