SA-MP Forums Archive
MySQL no load [REP+] - 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 no load [REP+] (/showthread.php?tid=574653)



MySQL no load [REP+] - Drek - 19.05.2015

Hello,

Today I have a problem I explain:
My load is not executes if id 1 is not present, and even if eg id 1 and present but is followed by the id 20, so the id 20 is not going to charge this but only id 1.

Код:
	SA-MP MySQL plugin R5
	Copyright © 2008-2010, G-sTyLeZzZ
Here is my code:
pawn Код:
public Shop_load()
{
    new Requete[504], fields[57][MAX_PLAYER_NAME], row[320];

    format(Requete, sizeof(Requete), "SELECT COUNT(*) FROM shop");
    mysql_query(Requete);
    mysql_store_result();
    mysql_fetch_row(row);
    Total_shop = strval(row);
    mysql_free_result();

    for(new i=1; i<=Total_shop; i++)
    {
        format(Requete, sizeof(Requete), "SELECT * FROM shop WHERE id=%d", i);
        mysql_query(Requete);
        mysql_store_result();
        mysql_fetch_row(row);
        split(row, fields, '|');

        Shop_infos[i][shopX] = floatstr(fields[1]); printf(">   %f      !shopX", Shop_infos[i][shopX]);
        Shop_infos[i][shopY] = floatstr(fields[2]);
        Shop_infos[i][shopZ] = floatstr(fields[3]);
        Shop_infos[i][shopXexit] = floatstr(fields[4]);
        Shop_infos[i][shopYexit] = floatstr(fields[5]);
        Shop_infos[i][shopZexit] = floatstr(fields[6]);
        Shop_infos[i][shopCaisse] = strval(fields[7]);
        Shop_infos[i][shopInterieur] = strval(fields[8]);
        Shop_infos[i][shopLock] = strval(fields[9]);

        mysql_free_result();
    }
    printf(">   %d shop load        !", Total_shop);
    return 1;
}
Sincerely,
Drek.



Re: MySQL no load - RaeF - 19.05.2015

Why you don't uupdate it to the lastest version ? R39, R5 is too old and (Maybe) nobody want to answer this.


Re : MySQL no load - Drek - 19.05.2015

Because I prefer this version, and I'll see later if I want to change the version ..
Then this version works very well, nothing is missing .. I really like it when I code with me.


Re : MySQL no load [REP+] - Drek - 20.05.2015

Up !!!!!!!!!!!


Re : MySQL no load [REP+] - Drek - 22.05.2015

Up !!!!


Re: MySQL no load [REP+] - rappy93 - 22.05.2015

It is an outdated version of MySQL which could actually create this issue for you. Upgrade to the latest version to get support


Re: MySQL no load [REP+] - LMaxCo - 22.05.2015

SA-MP MySQL plugin R5 is too old dude, Change your MySQL to the SA-MP MySQL plugin R39 Or R38


Re: MySQL no load [REP+] - Matess - 22.05.2015

It's not about the fucking version of mysql plugin...

I am not sure, if i understood your problem, but try this.
PHP код:
public Shop_load()
{
    new 
Requete[504], fields[57][MAX_PLAYER_NAME], row[320];
    
format(Requetesizeof(Requete), "SELECT COUNT(*) FROM shop");
    
mysql_query(Requete);
    
mysql_store_result();
    
mysql_fetch_row(row);
    
Total_shop strval(row);
    
mysql_free_result();
    for(new 
i=1i<=Total_shopi++)
    {
        
format(Requetesizeof(Requete), "SELECT * FROM shop LIMIT %d,%d"i-1,i);
        
mysql_query(Requete);
        
mysql_store_result();
        
mysql_fetch_row(row);
        
split(rowfields'|');
                new 
id strval(fields[0]);
 
        
Shop_infos[id][shopX] = floatstr(fields[1]); printf(">    %f         !shopX"Shop_infos[id][shopX]);
        
Shop_infos[id][shopY] = floatstr(fields[2]);
        
Shop_infos[id][shopZ] = floatstr(fields[3]);
        
Shop_infos[id][shopXexit] = floatstr(fields[4]);
        
Shop_infos[id][shopYexit] = floatstr(fields[5]);
        
Shop_infos[id][shopZexit] = floatstr(fields[6]);
        
Shop_infos[id][shopCaisse] = strval(fields[7]);
        
Shop_infos[id][shopInterieur] = strval(fields[8]);
        
Shop_infos[id][shopLock] = strval(fields[9]);
        
mysql_free_result();
    }
    
printf(">    %d shop load        !"Total_shop);
    return 
1;




Re : MySQL no load [REP+] - Drek - 24.05.2015

But to upgrade to this version , his ask me too much time, and on top of that I do not know anything about the R39 verison , so its take me too much time , so if someone is available to give me a call hand for this version.


Re : MySQL no load [REP+] - Drek - 26.05.2015

The code does not work, a little up , please
But maybe its not coming charging, but the INSERT, so here is the code

pawn Код:
public Plante_update(i)
{
    new Requete[1024], result[LITTLE_STRING], Requetes[1024];
   
    format(Requetes, sizeof(Requetes), "SELECT COUNT(*) FROM therp_plantes");
    mysql_query(Requetes);

    mysql_store_result();
    mysql_fetch_row(result);

    i = strval(result) + 1;
    mysql_free_result();
   
    format(Requete, sizeof(Requete),"INSERT INTO therp_plantes SET `Type`='%d', `Variete`='%d', `Sexe`='%d', `Recolte`='%d', `Temps`='%d', `X`='%f', `Y`='%f', `Z`='%f'",

    Plante_infos[i][Plante_type],
    Plante_infos[i][Plante_variete],
    Plante_infos[i][Plante_sexe],
    Plante_infos[i][Plante_recolte],
    Plante_infos[i][Plante_temps],
    Plante_infos[i][Plante_X],
    Plante_infos[i][Plante_Y],
    Plante_infos[i][Plante_Z]);

    mysql_query(Requete);
    return 1;
}