SA-MP Forums Archive
Mysql question - 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: Mysql question (/showthread.php?tid=530822)



Mysql question - kamiliuxliuxliux - 09.08.2014

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;



Re: Mysql question - Tommboow - 09.08.2014

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;
}



Re: Mysql question - kamiliuxliuxliux - 09.08.2014

cache_get_field_content_int gets strings? Floats?


Re: Mysql question - kamiliuxliuxliux - 09.08.2014

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