Retrieving a singular set of data from a MySQL database - 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: Retrieving a singular set of data from a MySQL database (
/showthread.php?tid=376377)
Retrieving a singular set of data from a MySQL database -
vIBIENNYx - 10.09.2012
I need to select some data from the SQL database BEFORE the entire player data set loads.
pawn Код:
new EscPass[38], Query[128];
new saltquery[156], salt[32], string[128];
format(saltquery, sizeof(saltquery), "SELECT `psalt` FROM `playerinfo` WHERE `username` = '%s'", pName(playerid));
mysql_query(saltquery);
print(saltquery);
format(salt, sizeof(salt), "%s", mysql_store_result());
print(salt);
format(string, sizeof(string), "%s%s", salt, inputtext);
print(string);
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `username` = '%s' AND `ppassword` = md5('%s')", pName(playerid), string);
mysql_query(Query);
mysql_store_result();
I am trying to retrieve "psalt" and then store it in a string, so that I can merge it with the input text for the dialogue, any help would be greatly appreciated.
Re: Retrieving a singular set of data from a MySQL database -
Calgon - 10.09.2012
mysql_store_result stores the data in memory, it doesn't return it as a string...
Use mysql_store_result and then a function to retrieve the data from MySQL, see
here if you're using BlueG's plugin.
Re: Retrieving a singular set of data from a MySQL database -
vIBIENNYx - 10.09.2012
Quote:
Originally Posted by Calgon
mysql_store_result stores the data in memory, it doesn't return it as a string...
Use mysql_store_result and then a function to retrieve the data from MySQL, see here if you're using BlueG's plugin.
|
Thanks mate.