20.02.2017, 16:42
Hello, i make a kind of ban system but when i try to check the databse this error happens:
SELECT statement at OnPlayerConnect:
The callback:
And the actual table:
http://imgur.com/KMTDrWe
PHP код:
(error #1054) Unknown column 'Banditul' in 'where clause' (Query: "SELECT * FROM `bans` WHERE (`BanName` = `Banditul` OR `IP` = '127.0.0.1') LIMIT 1")
PHP код:
mysql_format(g_SQL, query, sizeof(query),"SELECT * FROM `bans` WHERE (`BanName` = `%e` OR `IP` = '%e') LIMIT 1",APlayerData[playerid][PlayerName],IP);
mysql_tquery(g_SQL, query, "BanCheck","i",playerid);
PHP код:
forward BanCheck(playerid);
public BanCheck(playerid)
{
new admin[24], pname[24],Reason[60], string[60],bantime;
new rows = cache_num_rows();
if(rows)
{
for(new row; row < rows; row++)
{
cache_get_field_content(row, "AdminName", admin, g_SQL, sizeof(admin));
cache_get_field_content(row, "BanName", pname, g_SQL, sizeof(pname));
cache_get_field_content(row, "Reason", Reason, g_SQL, sizeof(Reason));
bantime = cache_get_field_content_int(row, "BanTime", g_SQL);
}
}
SendClientMessage(playerid, C_RED,"Esti banat pe acest server!");
SendClientMessage(playerid, C_RED,"___________________");
format(string, sizeof(string),"Admin: %s", admin);
SendClientMessage(playerid, C_RED, string);
format(string, sizeof(string),"Nume: %s", pname);
SendClientMessage(playerid, C_RED, string);
format(string, sizeof(string),"Motiv: %s", Reason);
SendClientMessage(playerid, C_RED, string);
format(string, sizeof(string),"Timp ramas: %s", CalculateBanTime(bantime));
SendClientMessage(playerid, C_RED, string);
SendClientMessage(playerid, C_RED,"___________________");
SendClientMessage(playerid, C_RED, "Daca crezi ca ai primit ban pe nedrept fa o poza(F8) si posteaza-o pe forum la sectiuena serverului.");
SendClientMessage(playerid, C_RED, "www.gamelive.ro/forum");
SetTimerEx("TimedKick", 500, false, "i", playerid);
return 1;
}
http://imgur.com/KMTDrWe