SA-MP Forums Archive
mysql function - 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 function (/showthread.php?tid=411252)



mysql function - BlackRaven - 28.01.2013

pawn Код:
stock LoadPlayerKeys()
{
    for(new i; i < 5; i++)
    {
        new query[200];
        format(query, sizeof(query),"SELECT * FROM vehicles WHERE owner = '%s'","Mark");
        mysql_query(query);
        mysql_store_result();
        if(mysql_num_rows())
        if(mysql_fetch_row(query))
        {
            sscanf(query, "p<|>e<i>",playerkeys[i]);
            printf("keys loaded %d",playerkeys[i]);
            printf("%s",query);
        }
    }
}
What is wrong with this code? Im trying to load all the vehicle ids to the playerkeys variable but it prints only id 1


Re: mysql function - BlackRaven - 28.01.2013

I made a print of the query and it was the same five times.


Re: mysql function - BlackRaven - 28.01.2013

Quote:

[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] keys loaded 1
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] keys loaded 1
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] keys loaded 1
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] keys loaded 1
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03] keys loaded 1
[13:34:03] 1|555|1|1|0|0|0|0|Mark|0|0|0
[13:34:03]

Here is the output. It loads always the same result!


Re: mysql function - BlackRaven - 28.01.2013

Can the problem be with the plugin? Im using strickenskid plugin.


Re: mysql function - Vince - 28.01.2013

No. Use a while loop.


Re: mysql function - BlackRaven - 29.01.2013

I tryed the while loop but it bugs.