mysql function
#1

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

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

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!
Reply
#4

Can the problem be with the plugin? Im using strickenskid plugin.
Reply
#5

No. Use a while loop.
Reply
#6

I tryed the while loop but it bugs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)