Retrieving a singular set of data from a MySQL database
#1

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)