Mysql question
#1

I want to SELECT 1 string, 1 float and 1 integer from MySQL database.
pawn Код:
SELECT `name`, `age`, `posX` FROM accounts WHERE `pass` = '%e' // blah blah blah
Now how can I write that info (name, age and posX) to variables:
pawn Код:
new gName[MAX_PLAYER_NAME+1],gAge,Float:posX;
Reply
#2

I did it like this

Код:
mysql_format(mysql, query, sizeof(query),"SELECT `name`, `age`, `posX` FROM accounts WHERE `pass` = '%e' ", pInfo[Password]);
mysql_tquery(mysql, query, "getInfo", "i", playerid);


forward getInfo(playerid);
public getInfo(playerid)
{
    pInfo[playerid][name] = cache_get_field_content_int(0, "name");
    pInfo[playerid][age] = cache_get_field_content_int(0, "age");
    pInfo[playerid][posX] = cache_get_field_content_int(0, "posX");
    return 1;
}
Reply
#3

cache_get_field_content_int gets strings? Floats?
Reply
#4

But is there any ways to do that without new callback?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)