new playername[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playername, sizeof(playername));
format(query, sizeof(query), "SELECT UserName FROM 'usuarios' WHERE 'UserName' = '%s'", playername);
ConexionMySQL();
mysql_real_escape_string(playername, playername);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1){
PlayerInfo[playerid][Registered] = 1;
}
else{
PlayerInfo[playerid][Registered] = 0;
}
mysql_store_result();
[01:11:32] Incoming connection: 127.1.1.1:2092 [01:11:32] [join] The_Chaoz has joined the server (0:127.1.1.1) [01:11:32] MySQL Error (0): Could not execute query. 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 ''usuarios' WHERE 'UserName' = 'The_Chaoz'' at line 1. [01:11:32] MySQL Error (0): Could not store result. 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 ''usuarios' WHERE 'UserName' = 'The_Chaoz'' at line 1.
new playername[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playername, sizeof(playername));
mysql_real_escape(playername, playername);
format(query, sizeof(query), "SELECT * FROM `usuarios` WHERE UserName = '%s'", playername);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1) PlayerInfo[playerid][Registered] = 1;
else PlayerInfo[playerid][Registered] = 0;
mysql_free_result();
new playername[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playername, sizeof(playername));
format(query, sizeof(query), "SELECT * FROM `usuarios` WHERE UserName = '%s'", playername);
ConexionMySQL();
mysql_real_escape_string(playername, playername);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1){
PlayerInfo[playerid][Registered] = 1;
}
else{
PlayerInfo[playerid][Registered] = 0;
}
mysql_store_result();
[02:11:25] Incoming connection: 127.1.1.1:2509 [02:11:25] [join] The_Chaoz has joined the server (0:127.1.1.1) [02:11:25] MySQL Error (0): 'mysql_store_result' called when result already stored. Please use 'mysql_free_result' first.. [02:11:25] MySQL Error (0): Could not execute query. 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 ''usuarios' WHERE UserName=The_Chaoz' at line 1.
Originally Posted by SAWC™
pawn Код:
|
Originally Posted by SAWC™
Quote:
|
error 017: undefined symbol "mysql_real_escape" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
mysql_real_escape_string(playername, playername);
new playername[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playername, sizeof(playername));
mysql_real_escape_string(playername, playername);
format(query, sizeof(query), "SELECT * FROM `usuarios` WHERE UserName = '%s'", playername);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1) PlayerInfo[playerid][Registered] = 1;
else PlayerInfo[playerid][Registered] = 0;
mysql_free_result();
[02:26:02] Incoming connection: 127.1.1.1:2616 [02:26:02] [join] The_Chaoz has joined the server (0:127.1.1.1) [02:26:02] MySQL Error (0): Could not execute query. 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 ''usuarios' WHERE UserName=The_Chaoz' at line 1.
stock CheckAccount(playerid)
{
MySQLCheck();
new
query[70];
format(query, sizeof(query), "SELECT * FROM `players` WHERE Nickname = '%s'", Player[playerid][Name]);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0) Player[playerid][Registered] = 1;
else Player[playerid][Registered] = 0;
mysql_free_result();
}
public OnPlayerConnect(playerid)
{
...
CheckAccount(playerid);
if(Player[playerid][Registered] == 1) BlaBlaBla;
else BlaBlaBla2;
return 1;
}
public OnPlayerConnect(playerid)
{
CheckAccount(playerid);
//code....
return 1;
}
stock ConexionMySQL()
{
if(mysql_ping() == 0)
{
return true;
}
else
{
mysql_reload();
ConexionMySQL();
}
return false;
}
//----------------------------------------------------------------------------------
stock CheckAccount(playerid)
{
ConexionMySQL();
new query[70], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(query, sizeof(query), "SELECT * FROM `usuarios` WHERE UserName = '%s'", playername);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0) PlayerInfo[playerid][Registered] = 1;
else PlayerInfo[playerid][Registered] = 0;
mysql_free_result();
}
[02:46:04] Incoming connection: 127.1.1.1:2841 [02:46:04] [join] The_Chaoz has joined the server (0:127.1.1.1) [02:46:04] MySQL Error (0): Could not execute query. 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 ''usuarios' WHERE UserName=The_Chaoz' at line 1.
ChequearMySQL()
{
if(mysql_ping() == -1) mysql_connect(SQL_HOST, SQL_USER,SQL_DB, SQL_PASS); // remember to define those
return 1;
}