SQL results.
#7

I personally believe you're better off using BlueG's threaded queries. Something along these lines:

pawn Код:
new str[128]; // cbf to count for an example lol
// Remember to actually escape the name, otherwise u'll be vulnerable for SQL Injections
format(str, 128, "SELECT Username, Fines FROM `Accounts` WHERE `Username` = '%s'", NameEntered);
mysql_function_query( connectionHandle, str, true, "StoreMDC", "i", playerid );


forward StoreMDC(playerid);
public StoreMDC(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        new tmp[2][32];
        cache_get_field_content(0/*row*/, "Username", tmp[0], connectionHandle);
        cache_get_field_content(0, "Fines", tmp[1], connectionHandle);
    }
    return 1;
}
The above is threaded and doesn't pause your script while awaiting a response from the database. I am just gonna assume you know how to convert a string to a value. ( strval *cough* ).

You should also have a look at this very important post related to that system:

https://sampforum.blast.hk/showthread.php?tid=337810

and for security issues that come up with this threaded architecture check this one out:

http://forum.sa-mp.com/showpost.php?...postcount=2141

You'll find the link above at the end of the first thread as well and there will be another one explaining how it all works and how you may retrieve the info. I am sure you'll find your way through =).

Regards.
Reply


Messages In This Thread
SQL results. - by iGetty - 07.06.2012, 02:19
Re: SQL results. - by Kitten - 07.06.2012, 02:22
Re: SQL results. - by iGetty - 07.06.2012, 02:24
Re: SQL results. - by mati233 - 07.06.2012, 02:27
Re: SQL results. - by Lorenc_ - 07.06.2012, 02:29
Re: SQL results. - by iGetty - 07.06.2012, 02:30
AW: SQL results. - by Extremo - 07.06.2012, 02:40
Re: SQL results. - by kikito - 07.06.2012, 10:35
Re: SQL results. - by Pizzy - 10.06.2012, 15:39

Forum Jump:


Users browsing this thread: 1 Guest(s)