MySQL. NEED HELP!
#1

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).
Reply
#2

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.
Reply
#3

Yeah dude, your result there has 164 characters.
Reply
#4

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...
Reply
#5

Urrr... Bump
Reply
#6

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".
Reply
#7

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.
Reply
#8

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?
Reply
#9

No, Sergei.. what are they?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)