[HELP] Store from mysql to variable
#1

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)