SA-MP Forums Archive
[HELP] Mysql Data loading - 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: [HELP] Mysql Data loading (/showthread.php?tid=639866)



[HELP] Mysql Data loading - Eoussama - 24.08.2017

Hello there, hope you're doing great,
So, I'm trying to load few things from a table `Strg`, I have, for example, 2 rows, but only the first row loads, leaving the second ignored for some reason.

PHP код:
LoadDataEx()
{
    
mysql_tquery(handle"SELECT * FROM `Strg`""SQL_LoadDataEx");
    return 
1;
}
forward SQL_LoadDataEx();
public 
SQL_LoadDataEx()
{
    new 
rows cache_num_rows(), _id;
    if(
rows)
    {
        
printf("Rows: %d"rows);
        for(new 
Qr 0Qr!=rowsQr++)
        {    
            
cache_get_value_name_int(Qr"ID"_id);
            
printf("Iterator: %d | ID: %d"Qr_id);
        }
    }
    return 
1;

This is what should be loaded from the table


This is what prints out
Код:
Rows: 2
Iterator: 0 | ID: 0
Iterator: 1 | ID: 0
I tried different loops, experimented with lots of things, but it still loads only one row, interestingly, when I skip over the first row for(new Qr = 1; Qr!=rows; Qr++), the second-row loads and vice versa.
I honestly don't know what could be the problem here, just for the record, I'm using MySQL R41-3.

Note: I don't know if this plays any factor in this at all, but the `ID` field is not auto incremented.

I hope someone could provide help, thanks in advance.


Re: [HELP] Mysql Data loading - Vince - 24.08.2017

Strange. I don't know why it would do that. It does print the correct amount of rows? It's probably going to be something painfully obvious but I'm not seeing it. Try using a variable that doesn't start with an underscore, though. The underscore, like the @-symbol which declares a function/variable as public, may have a special meaning when used as the first character of an identifier.


Re: [HELP] Mysql Data loading - Eoussama - 24.08.2017

Still the same tho,