[HELP] Store from mysql to variable - 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)
+--- Thread: [HELP] Store from mysql to variable (
/showthread.php?tid=510340)
[HELP] Store from mysql to variable -
hariprasetyoaji - 30.04.2014
Hello, im new pawn mysql.
i already searching for a same problems with me on this forum, but i still doesnt know how to solve this.
i want to get the "id" values from mysql user data to store to PlayerInfo[playerid][pID]
the mysql query, look like this.
Quote:
SELECT id FROM users WHERE name = "someplayername"
|
thanks for your help
Re: [HELP] Store from mysql to variable -
hariprasetyoaji - 30.04.2014
Quote:
Originally Posted by Rehasher
Edit this.
pawn Код:
new gQuery[300]; format(gQuery, sizeof(gQuery), "SELECT `ID` FROM `users` WHERE `Username` = '%s' LIMIT 1", usernamething_whateverhere); mysql_query(gQuery); mysql_store_result(); PlayerInfo[playerid][pID] = mysql_fetch_int(); mysql_free_result();
|
its not working, i got "-1" value for PlayerInfo[playerid][pID]. when i have id=7 for username Harold_Stifler(my username) on phpmyadmin.
but, thanks for your help
Re: [HELP] Store from mysql to variable -
hariprasetyoaji - 02.05.2014
Quote:
Originally Posted by Rehasher
did you do the exact same query?
try
pawn Код:
new result[200]; mysql_get_field("ID", result); PlayerInfo[playerid][pID] = strval(result);
|
thanks it works