PDA

View Full Version : MySQL no load [REP+]


Drek
19/05/2015, 08:31 AM
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 (c) 2008-2010, G-sTyLeZzZ


Here is my code:

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.

RaeF
19/05/2015, 08:36 AM
Why you don't uupdate it to the lastest version ? R39, R5 is too old and (Maybe) nobody want to answer this.

Drek
19/05/2015, 08:37 AM
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.

Drek
20/05/2015, 08:31 AM
Up !!!!!!!!!!!

Drek
22/05/2015, 07:37 AM
Up !!!!

rappy93
22/05/2015, 11:47 AM
It is an outdated version of MySQL which could actually create this issue for you. Upgrade to the latest version to get support ;)

LMaxCo
22/05/2015, 11:54 AM
SA-MP MySQL plugin R5 is too old dude, Change your MySQL to the SA-MP MySQL plugin R39 Or R38

Matess
22/05/2015, 12:19 PM
It's not about the fucking version of mysql plugin...

I am not sure, if i understood your problem, but try this.
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 LIMIT %d,%d", i-1,i);
mysql_query(Requete);
mysql_store_result();
mysql_fetch_row(row);
split(row, fields, '|');
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;
}

Drek
24/05/2015, 12:42 PM
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.

Drek
26/05/2015, 10:44 AM
The code does not work, a little up , please ;)
But maybe its not coming charging, but the INSERT, so here is the code


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;
}