Problem saving statistics. [MYSQL] -
Oscii - 16.02.2013
Hello, i've got a problem on my test server that i'm unable to solve where the statistics of my server don't save! I get a syntax error in the mysql_log, the code is:
pawn Код:
//Mysql
public SaveInfo(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(JugadorLogeado[playerid] == 0) return 0;
printf("Saving %s (%i) data...", PlayerNameEx(playerid), playerid);
// Update the players IP address
// GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 20);
// Get the player weapons
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapons[playerid][i][0], PlayerWeapons[playerid][i][1]);
}
new Query[3500];
format(Query, sizeof(Query), "UPDATE `users` SET PuntosRol = '%i', Weapon = '%i', Weapon2 = '%i', Weapon3 = '%i', Ammo = '%i', Ammo2 = '%i', Ammo3 = '%i'", PlayerInfo[playerid][jPuntosR], PlayerInfo[playerid][jWeapon], PlayerInfo[playerid][jWeapon2], PlayerInfo[playerid][jWeapon3], PlayerInfo[playerid][jAmmo], PlayerInfo[playerid][jAmmo2], PlayerInfo[playerid][jAmmo3]);
format(Query, sizeof(Query), "%s, VIP = '%i', Admin = '%i', Coins = '%i', Nivel = '%i', Banned = '%i', Member = '%i', Exp = '%i', PermZombie = '%d', MedicinaA = '%i', MedicinaB = '%i'", Query, PlayerInfo[playerid][jVip], PlayerInfo[playerid][jAdmin], PlayerInfo[playerid][jCoins], PlayerInfo[playerid][jLevel], PlayerInfo[playerid][jBanned], PlayerInfo[playerid][jMember], PlayerInfo[playerid][jExp], PlayerInfo[playerid][jPermZomb], PlayerInfo[playerid][jMedicinaA], PlayerInfo[playerid][jMedicinaB]);
format(Query, sizeof(Query), "%s, Tazer = '%i', Vendas = '%i', KitMed = '%i', Bengala` = '%i', Adrenalina = '%i', Radio = '%i', Leader = '%i', Tutorial = '%d', Origen = '%i'", Query, PlayerInfo[playerid][jTazer], PlayerInfo[playerid][jVendas], PlayerInfo[playerid][jKitMed], PlayerInfo[playerid][jBengala], PlayerInfo[playerid][jAdrenalina], PlayerInfo[playerid][jWalkie], PlayerInfo[playerid][jLeader], PlayerInfo[playerid][jTutorial], PlayerInfo[playerid][jOrigen]);
format(Query, sizeof(Query), "%s, `Sexo` = '%i', `Profesion` = '%i', `Edad` = '%i', `PorqueSalio` = '%i', `Spawn` = '%i', `Pos_x` = '%f', `Pos_y` = '%f', `Pos_z` = '%f', `Int` = '%i'", Query, PlayerInfo[playerid][jSexo], PlayerInfo[playerid][jProfesion], PlayerInfo[playerid][jAge], PlayerInfo[playerid][jPorSalio], PlayerInfo[playerid][jSpawn], PlayerInfo[playerid][jPos_x], PlayerInfo[playerid][jPos_y], PlayerInfo[playerid][jPos_z], PlayerInfo[playerid][jInt]);
format(Query, sizeof(Query), "%s, Ropa = '%i', Vida` = '%i', Armour = '%i', Nafta = '%i', Fosforos` = '%i', Botella` = '%i', Guantes` = '%i', Reporte = '%i', `Punteria` = '%i'", Query, PlayerInfo[playerid][jRopa], PlayerInfo[playerid][jVida], PlayerInfo[playerid][jArmour], PlayerInfo[playerid][jNafta], PlayerInfo[playerid][jFosforos], PlayerInfo[playerid][jBottle], PlayerInfo[playerid][jGuantes], PlayerInfo[playerid][jReport], PlayerInfo[playerid][jPunteria]);
format(Query, sizeof(Query), "%s, Mechanic = '%i', Luck = '%i', Mordedor = '%i', Zombie = '%i', Reloj = '%i', Hours = '%i', Encarcelado = '%i', TiempoDeCarcel = '%i'", Query, PlayerInfo[playerid][jMechanic], PlayerInfo[playerid][jLuck], PlayerInfo[playerid][jZombiesPT], PlayerInfo[playerid][jZombie], PlayerInfo[playerid][jReloj], PlayerInfo[playerid][jHours], PlayerInfo[playerid][jEncarcelado], PlayerInfo[playerid][jTiempoDeCarcel]);
format(Query, sizeof(Query), "%s, ZombieCa = '%i', Virus = '%i', Lente = '%i', Hat = '%i', Rank = '%i', Health = '%f'", Query, PlayerInfo[playerid][jZombieC], PlayerInfo[playerid][jVirusD], PlayerInfo[playerid][jLente], PlayerInfo[playerid][jHat], PlayerInfo[playerid][jRank], PlayerInfo[playerid][jHealth]);
// Do NOT remove this line otherwise it'll die!
format(Query, sizeof(Query), "%s WHERE id = '%i'", Query, PlayerInfo[playerid][jMySQLID]);
mysql_function_query(cHandle, Query, false, "", "");
return 1;
}
Anyone know a resolution?
Regards
Oscii
Re: Problem saving statistics. [MYSQL] -
ReneG - 16.02.2013
Enable debugging, that's what it's there for
EDIT: print the query and post the output
Re: Problem saving statistics. [MYSQL] -
Oscii - 16.02.2013
Debugging is there its just telling me there is a syntax error on that query,
I've recently noticed that the query responds:
Код:
[01:00:00] Passing query UPDATE `users` SET PuntosRol = '10', Weapon = '0', Weapon2 = '0', Weapon3 = '0', Ammo = '0', Ammo2 = '0', Ammo3 = '0', VIP = '0', Admin = '1338', Coins = '1303340', Nivel = '3', Banned = '0', Member = '1', Exp = '0', PermZombie = '0', MedicinaA = '0', MedicinaB = '0', Tazer = '1', Vendas = '0', KitMed = '2', Bengala` = '1', Adrenalina = '0', Radio = '0', Leader = '1', Tutorial = '1', Origen = '1', Sexo = '2', Profesion = '1', Edad = '5', PorqueSalio = '76', Spawn = '0', Pos_x = '54.228538', Pos_y = '1172.136718', Pos_z = '18.664062', Int = '0', Ropa = '78', Vida = '1114636288', Armour = '0', Nafta = '0', Fosforos = '0', Botella = '0', Guantes = '0', Reporte = '0', Punteria = '0', Mechanic = '1', Luck = '12', Mordedor = '5', Zombie = '1', Reloj = '1', Hours = '1', Encarcelado = '5', TiempoDeCarcel = '0', ZombieCa = '1', Virus = '1', Lente = '0', Hat = '0', Rank = '0', Health = '60.000000' WHERE id = '13' |
[01:00:00] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[01:00:00] OnQueryError() - Called.
But it always spawns me incorrect/old stats before the most recent /q.
Re: Problem saving statistics. [MYSQL] -
Oscii - 16.02.2013
Here is the errror its giving me:
Код:
[22:24:14] errorid: 1064 | error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '` = '1', Adrenalina = '0', Radio = '0', Leader = '1', Tutorial = '1', Origen = '' at line 1 | callback: | query: UPDATE `users` SET PuntosRol = '10', Weapon = '0', Weapon2 = '0', Weapon3 = '0', Ammo = '0', Ammo2 = '0', Ammo3 = '0', VIP = '0', Admin = '1338', Coins = '760', Nivel = '2', Banned = '0', Member = '1', Exp = '3', PermZombie = '0', MedicinaA = '0', MedicinaB = '0', Tazer = '1', Vendas = '0', KitMed = '2', Bengala` = '1', Adrenalina = '0', Radio = '0', Leader = '1', Tutorial = '1', Origen = '1', Sexo = '2', Profesion = '1', Edad = '5', PorqueSalio = '76', Spawn = '0', Pos_x = '626.044555', Pos_y = '750.083740', Pos_z = '-13.082941', Int = '0', Ropa = '160', Vida = '1114636288', Armour = '0', Nafta = '0', Fosforos = '0', Botella = '0', Guantes = '0', Reporte = '0', Punteria = '0', Mechanic = '1', Luck = '12', Mordedor = '5', Zombie = '1', Reloj = '1', Hours = '1', Encarcelado = '5', TiempoDeCarcel = '0', ZombieCa = '1', Virus = '1', Lente = '0', Hat = '0', Rank = '0', Health = '60.000000' WHERE id = '13'
Re: Problem saving statistics. [MYSQL] -
Shaneisace - 16.02.2013
You can see it here
Код:
KitMed = '%i', Bengala` = '%i', Adrenalina = '%i',
You can see the ` after the word i highlighted it in red
pawn Код:
//Mysql
public SaveInfo(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(JugadorLogeado[playerid] == 0) return 0;
printf("Saving %s (%i) data...", PlayerNameEx(playerid), playerid);
// Update the players IP address
// GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 20);
// Get the player weapons
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapons[playerid][i][0], PlayerWeapons[playerid][i][1]);
}
new Query[3500];
format(Query, sizeof(Query), "UPDATE `users` SET `PuntosRol` = '%i', `Weapon` = '%i', `Weapon2` = '%i', `Weapon3` = '%i', `Ammo` = '%i', `Ammo2` = '%i', `Ammo3` = '%i'", PlayerInfo[playerid][jPuntosR], PlayerInfo[playerid][jWeapon], PlayerInfo[playerid][jWeapon2], PlayerInfo[playerid][jWeapon3], PlayerInfo[playerid][jAmmo], PlayerInfo[playerid][jAmmo2], PlayerInfo[playerid][jAmmo3]);
format(Query, sizeof(Query), "%s, `VIP` = '%i', `Admin` = '%i', `Coins` = '%i', `Nive`l = '%i', `Banned` = '%i', Member = '%i', Exp = '%i', PermZombie = '%d', MedicinaA = '%i', MedicinaB = '%i'", Query, PlayerInfo[playerid][jVip], PlayerInfo[playerid][jAdmin], PlayerInfo[playerid][jCoins], PlayerInfo[playerid][jLevel], PlayerInfo[playerid][jBanned], PlayerInfo[playerid][jMember], PlayerInfo[playerid][jExp], PlayerInfo[playerid][jPermZomb], PlayerInfo[playerid][jMedicinaA], PlayerInfo[playerid][jMedicinaB]);
format(Query, sizeof(Query), "%s, `Tazer` = '%i', `Vendas` = '%i', `KitMed` = '%i', `Bengala` = '%i', `Adrenalina` = '%i', `Radio` = '%i', `Leader` = '%i', `Tutorial` = '%d', `Origen` = '%i'", Query, PlayerInfo[playerid][jTazer], PlayerInfo[playerid][jVendas], PlayerInfo[playerid][jKitMed], PlayerInfo[playerid][jBengala], PlayerInfo[playerid][jAdrenalina], PlayerInfo[playerid][jWalkie], PlayerInfo[playerid][jLeader], PlayerInfo[playerid][jTutorial], PlayerInfo[playerid][jOrigen]);
format(Query, sizeof(Query), "%s, `Sexo` = '%i', `Profesion` = '%i', `Edad` = '%i', `PorqueSalio` = '%i', `Spawn` = '%i', `Pos_x` = '%f', `Pos_y` = '%f', `Pos_z` = '%f', `Int` = '%i'", Query, PlayerInfo[playerid][jSexo], PlayerInfo[playerid][jProfesion], PlayerInfo[playerid][jAge], PlayerInfo[playerid][jPorSalio], PlayerInfo[playerid][jSpawn], PlayerInfo[playerid][jPos_x], PlayerInfo[playerid][jPos_y], PlayerInfo[playerid][jPos_z], PlayerInfo[playerid][jInt]);
format(Query, sizeof(Query), "%s, `Ropa` = '%i', `Vida` = '%i', `Armour` = '%i', `Nafta` = '%i', `Fosforos` = '%i', Botella` = '%i', Guantes` = '%i', Reporte = '%i', `Punteria` = '%i'", Query, PlayerInfo[playerid][jRopa], PlayerInfo[playerid][jVida], PlayerInfo[playerid][jArmour], PlayerInfo[playerid][jNafta], PlayerInfo[playerid][jFosforos], PlayerInfo[playerid][jBottle], PlayerInfo[playerid][jGuantes], PlayerInfo[playerid][jReport], PlayerInfo[playerid][jPunteria]);
format(Query, sizeof(Query), "%s, `Mechanic` = '%i', `Luck` = '%i', `Mordedor` = '%i', `Zombie` = '%i', `Reloj` = '%i', `Hours` = '%i', `Encarcelado` = '%i', `TiempoDeCarcel` = '%i'", Query, PlayerInfo[playerid][jMechanic], PlayerInfo[playerid][jLuck], PlayerInfo[playerid][jZombiesPT], PlayerInfo[playerid][jZombie], PlayerInfo[playerid][jReloj], PlayerInfo[playerid][jHours], PlayerInfo[playerid][jEncarcelado], PlayerInfo[playerid][jTiempoDeCarcel]);
format(Query, sizeof(Query), "%s, `ZombieCa` = '%i', `Virus` = '%i', `Lente` = '%i', `Hat` = '%i', `Rank` = '%i', `Health` = '%f'", Query, PlayerInfo[playerid][jZombieC], PlayerInfo[playerid][jVirusD], PlayerInfo[playerid][jLente], PlayerInfo[playerid][jHat], PlayerInfo[playerid][jRank], PlayerInfo[playerid][jHealth]);
// Do NOT remove this line otherwise it'll die!
format(Query, sizeof(Query), "%s WHERE `id` = '%i'", Query, PlayerInfo[playerid][jMySQLID]);
mysql_function_query(cHandle, Query, false, "", "");
return 1;
}
There i added the ` for you.