1
Scripting SA-MP [Pawn center] / MySQL: Problème d'insertion
« le: 30 Juillet 2012, 14:16:41 »
Bonjour à tous,
Je viens posté ici car sur la communauté sa-mp.com il en est impossible.
Je fait un GameMode Team DeathMatch sur MySQL, et j'ai un souci lors de l'inscription :
Pour un code suivant :
Merci d'avance,
Double post
Sujet résolu, le problème venait d'un oubli d'un mysql_store_result(); dans les fonctions utilisés avant
Je viens posté ici car sur la communauté sa-mp.com il en est impossible.
Je fait un GameMode Team DeathMatch sur MySQL, et j'ai un souci lors de l'inscription :
Citer
[14:06:30]
[14:06:30] ---------------------------
[14:06:30] MySQL Debugging activated (07/30/12)
[14:06:30] ---------------------------
[14:06:30]
[14:06:30] >> mysql_connect( )
[14:06:30] CMySQLHandler::CMySQLHandler() - constructor called.
[14:06:30] CMySQLHandler::CMySQLHandler() - Connecting to "127.0.0.1" | DB: "tdm_revolution" | Username: "root" ...
[14:06:30] CMySQLHandler::Connect() - Connection was successful.
[14:06:30] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[14:06:30] >> mysql_ping( Connection handle: 1 )
[14:06:30] CMySQLHandler::Ping() - Connection is still alive.
[14:07:10] >> mysql_real_escape_string( Connection handle: 1 )
[14:07:10] CMySQLHandler::EscapeString(Pizza_4Saisons); - Escaped 14 characters to Pizza_4Saisons.
[14:07:10] >> mysql_query( Connection handle: 1 )
[14:07:10] CMySQLHandler::Query(SELECT Banni FROM joueurs WHERE Nom='Pizza_4Saisons' LIMIT 1) - Successfully executed.
[14:07:10] >> mysql_fetch_int( Connection handle: 1 )
[14:07:10] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[14:07:10] >> mysql_real_escape_string( Connection handle: 1 )
[14:07:10] CMySQLHandler::EscapeString(127.0.0.1); - Escaped 9 characters to 127.0.0.1.
[14:07:10] >> mysql_query( Connection handle: 1 )
[14:07:10] CMySQLHandler::Query(SELECT id FROM bannis WHERE IP='127.0.0.1' LIMIT 1) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
[14:07:10] >> mysql_num_rows( Connection handle: 1 )
[14:07:10] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[14:07:10] >> mysql_real_escape_string( Connection handle: 1 )
[14:07:10] CMySQLHandler::EscapeString(127.0.0.1); - Escaped 9 characters to 127.0.0.1.
[14:07:10] >> mysql_query( Connection handle: 1 )
[14:07:10] CMySQLHandler::Query(SELECT id FROM joueurs WHERE IP='127.0.0.1') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
[14:07:10] >> mysql_num_rows( Connection handle: 1 )
[14:07:10] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[14:07:15] >> mysql_query( Connection handle: 1 )
[14:07:15] CMySQLHandler::Query(INSERT INTO joueurs SET Nom='philipe', Banni=0, Password='test', IP='monip', Argent=2500, Niveau=1, Morts=0, Tues=0, Admin=0) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
Pour un code suivant :
Citer
stock CreateAccount(playerid, mdp[]) // Crée un compte dans la base de donnée
{
new requete[MAX_MYSQL];
new ipsql[16];
new nomsql[MAX_PLAYER_NAME];
new mdpsql[24];
mysql_real_escape_string(PlayerIP(playerid), ipsql);
mysql_real_escape_string(PlayerName(playerid), nomsql);
mysql_real_escape_string(mdp, mdpsql);
format(requete, sizeof(requete), "INSERT INTO joueurs SET Nom='%s', Banni=0, Password='%s', IP='%s', Argent=2500, Niveau=1, Morts=0, Tues=0, Admin=0", nomsql, mdpsql, ipsql);
mysql_query(requete);
}
Merci d'avance,
Double post
Sujet résolu, le problème venait d'un oubli d'un mysql_store_result(); dans les fonctions utilisés avant