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



MySQL - Rob_Zero - 06.07.2011

I maded this code for reading from Querry but i get errors

Код:
new data[3][50]; //The data strings
                   new data2[10]; //The data variables
                   mysql_query("SELECT * FROM `playerinfo`"data[1], data[2], data2[0], data2[1], data2[2], data2[3], data2[4], data2[5]);
                   SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
                   SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
                   SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
                   SetPlayerScore(playerid, data2[2]); //Sets players score
                   GivePlayerMoney(playerid, data2[3]); //Sets players cash
                   SetPVarInt(playerid, "Admin", data2[4]);
                   SetPVarInt(playerid, "GM", data2[5]);
                   mysql_free_result();
And errors:

Код:
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 001: expected token: ";", but found ")"
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 029: invalid expression, assumed zero
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
In the attachment is the database


Re: MySQL - [NoV]LaZ - 06.07.2011

https://sampwiki.blast.hk/wiki/MySQL#mysql_query

Check the function's parameters in that example. Then check yours.


Re: MySQL - Rob_Zero - 06.07.2011

But i dont understand how to read from fucking Querryyyyyyyyyyyyyyyyy


Re: MySQL - Jochemd - 06.07.2011

pawn Код:
new UselessData[129], data2[6], Playername[MAX_PLAYER_NAME],QueryString[100],Line[100];
GetPlayerName(playerid,Playername,sizeof(Playername));
format(QueryString,sizeof(QueryString),"SELECT * FROM `playerinfo` WHERE `user` = '%s'",Playername); // Select the row of the player
mysql_query(QueryString);
mysql_fetch_row(Line); // This gets whole MySQL row
sscanf(Line,"p<|>s[128]s[24]ddddds[24]dd",UselessData,UselessData,data2[0],data2[1],data2[2],data2[3],UselessData,data2[4],data2[5]); // Using SSCANF by ****** to split the line
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); // Set Score
GivePlayerMoney(playerid, data2[3]); // Set Cash
SetPVarInt(playerid, "Admin", data2[4]);
SetPVarInt(playerid, "GM", data2[5]);
mysql_free_result();
Read this properly and compare it to your own script


Re: MySQL - Rob_Zero - 06.07.2011

Again not working,no errors,data is saving but its not loading on Login


Re: MySQL - Rob_Zero - 06.07.2011

Bump...


Re: MySQL - Rob_Zero - 06.07.2011

Helpppppp..............


Re: MySQL - Jochemd - 06.07.2011

Do not bump your topic before 48 hours after last post -.-

Show more code.


Re: MySQL - Cadetz - 20.07.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
pawn Код:
new UselessData[129], data2[6], Playername[MAX_PLAYER_NAME],QueryString[100],Line[100];
GetPlayerName(playerid,Playername,sizeof(Playername));
format(QueryString,sizeof(QueryString),"SELECT * FROM `playerinfo` WHERE `user` = '%s'",Playername); // Select the row of the player
mysql_query(QueryString);
mysql_fetch_row(Line); // This gets whole MySQL row
sscanf(Line,"p<|>s[128]s[24]ddddds[24]dd",UselessData,UselessData,data2[0],data2[1],data2[2],data2[3],UselessData,data2[4],data2[5]); // Using SSCANF by ****** to split the line
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); // Set Score
GivePlayerMoney(playerid, data2[3]); // Set Cash
SetPVarInt(playerid, "Admin", data2[4]);
SetPVarInt(playerid, "GM", data2[5]);
mysql_free_result();
Read this properly and compare it to your own script
Whats the point of UseLess Data?

Код:
SELECT Colum1Name, Coloum2Name,etc FROM `playerinfo` WHERE `user` = '%s'",Playername);
Then there is no need for this extra varible