SA-MP Forums Archive
Mysql data load??? - 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 data load??? (/showthread.php?tid=635464)



Mysql data load??? - qmnty - 07.06.2017

I have a mysql table that stores some data from the player, but somehow sometimes it does not contain any data from the player ..

I am using mysql R39-6
For this kind of script loading data like this

Код:
New querys [128];
Mysql_format (mysqlcon, querys, sizeof (querys), "SELECT * FROM cars WHERE ownerid = '% d'", pInfo [playerid] [pMysqlID]);
Mysql_tquery (mysqlcon, querys, "accountOnLoadVehicle", "d", extraid);
And for response

Код:
Forward accountOnLoadVehicle (extraid);
Public accountOnLoadVehicle (extraid) {
New rows, fields;
Cache_get_data (rows, fields);
If (rows) {
For (new i; i <rows; i ++) {
New id = cache_get_field_content_int (i, "slot", mysqlcon);
New ids = cache_get_field_content_int (i, "ps", mysqlcon);

Bla ... bla..bla ....
**}
}
Return 1;
}
The table is the loading system with the result data loop using the slot of the vehicle for the index

Is there any error in loading the data ??

NB: That's only 1 table, in the script there are 5 similar tables that are loaded once

Thanks in advance... sorry for my bad english


Re: Mysql data load??? - Banditul18 - 07.06.2017

Maybe don't use space here ( '% d' ) in your mysql_format

PHP код:
forward accountOnLoadVehicle (extraid);
public 
accountOnLoadVehicle (extraid) {
    if (
cache_num_rows() > 0) {
        new 
id cache_get_field_content_int (0"slot"mysqlcon);
        new 
ids cache_get_field_content_int (0"ps"mysqlcon);
    }
    return 
1;

Stop using uppercase for ducking standard notations. They are write with lowercase for a ducking reason.


Re: Mysql data load??? - saffierr - 07.06.2017

Plus; do not use ' ' unless it's a string.


Re: Mysql data load??? - qmnty - 08.06.2017

Thanks for reply..

Sorry it's must be '%d'

and ' ' that for using mysql query not for string

It can load normally, but sometimes can't load