MySQL. NEED 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. NEED HELP! (
/showthread.php?tid=216348)
MySQL. NEED HELP! -
1337connor - 25.01.2011
Ok. So I have
pawn Код:
new tmp[128];
format(tmp,sizeof(tmp),"SELECT * FROM `users` WHERE `username`=LOWER('%s')",PlayerName(playerid));
mysql_free_result();
mysql_query(tmp);
mysql_store_result();
mysql_fetch_row_format(tmp,"|");
printf(tmp);
sscanf(tmp,"e<p<|>iiiiiiiiiiiiiiiiiffiiis[50]fffiiiiiiiiiiiis[50]iiiiiiiiii>",PlayerInfo[playerid]);
mysql_free_result();
And it DOES print
Код:
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0.000000|0.000000|0|0|0||1480.389526|-1771.293945|18.795755|0|0|0|0|0|0|0|0|0|0|0|0||0|0|0|0|0|0|0|0|0|-1|Shiro_Michi|****(PASS)|10
But it doesn't seem to GO into the players stats(PlayerInfo).
Re: MySQL. NEED HELP! -
Vince - 25.01.2011
You're unformatting the result wrong. Look at the last three items, for example. Name is a string, but you have it as an int.
Edit: Also check your string's length. 128 might not be enough to fit the whole result in.
Re: MySQL. NEED HELP! -
Gabe - 25.01.2011
Yeah dude, your result there has 164 characters.
Re: MySQL. NEED HELP! -
1337connor - 26.01.2011
Quote:
Originally Posted by Vince
You're unformatting the result wrong. Look at the last three items, for example. Name is a string, but you have it as an int.
Edit: Also check your string's length. 128 might not be enough to fit the whole result in.
|
Thats is because it does not take the username into consideration, it is not loading it into my PlayerInfo. Neither the password, or ID are taken into consideration.
Although I have tried changing the strings size, it still does not work.
Any other suggestions, as I am having a VERY bad time doing this...
Re: MySQL. NEED HELP! -
1337connor - 26.01.2011
Urrr... Bump
Re: MySQL. NEED HELP! -
[MWR]Blood - 26.01.2011
You actually aren't inserting it.
pawn Код:
format(tmp,sizeof(tmp),"SELECT * FROM `users` WHERE `username`=LOWER('%s')",PlayerName(playerid));
You should use "INSERT INTO".
Re: MySQL. NEED HELP! -
Gabe - 26.01.2011
Quote:
Originally Posted by Delux13
You actually aren't inserting it.
pawn Код:
format(tmp,sizeof(tmp),"SELECT * FROM `users` WHERE `username`=LOWER('%s')",PlayerName(playerid));
You should use "INSERT INTO".
|
He's trying to grab data FROM the MySQL into a playerdata array in his script. He's doing the query right. It's probably something to do with sscanf, which I don't have much experience in.
Re: MySQL. NEED HELP! -
Sergei - 26.01.2011
Quote:
Originally Posted by 1337connor
Thats is because it does not take the username into consideration, it is not loading it into my PlayerInfo. Neither the password, or ID are taken into consideration.
Although I have tried changing the strings size, it still does not work.
Any other suggestions, as I am having a VERY bad time doing this...
|
Ever heard of quiet tags?
Re: MySQL. NEED HELP! -
1337connor - 26.01.2011
No, Sergei.. what are they?