MySQL syntax error
#1

Код:
forward OfflineBanCheck(adminid, reason[]);
public OfflineBanCheck(adminid, reason[])
{
	new rows, fields;
    cache_get_data(rows, fields, mysql);

    if(rows)
    {
    	new ip[16], name[MAX_PLAYER_NAME], seconds, query[144], string[128];

    	cache_get_field_content(0, "Name", name, mysql, MAX_PLAYER_NAME);
		cache_get_field_content(0, "IP", ip);
		seconds = (gettime()+604800);
        
    	mysql_format(mysql, query, sizeof(query), "INSERT INTO `bans` (`Player`, `IP`, `Reason`, `Unban date`, `Banned by`) VALUES ('%e', '%e', '%e', '%d', '%e')", name, ip, reason, seconds, Name(adminid));
    	mysql_tquery(mysql, query, "", "");

    	SendClientMessage(adminid, C_LRED, "Player banned!");

    } else return SendClientMessage(adminid, C_LRED, "Player not found!");
	return 1;
}
And error:

Код:
[08:19:12] [DEBUG] mysql_tquery - scheduling query "INSERT INTO `bans` (`Player`, `IP`, `Reason`, `Unban date`, `Banned by`) VALUES ('noob123', '94.123.200.55', 'Reason', '1440245952', '"..
[08:19:12] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[08:19:12] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
[08:19:12] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[08:19:12] [ERROR] CMySQLQuery::Execute[()] - (error #1064) 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 ''' at line 1
[08:19:12] [DEBUG] CMySQLQuery::Execute[()] - error will be triggered in OnQueryError
[08:19:12] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks()
[08:19:12] [DEBUG] Calling callback "OnQueryError"..
Cant see the mistake here, hmm?
Reply


Messages In This Thread
MySQL syntax error - by sjames - 15.08.2015, 12:22
Re: MySQL syntax error - by sjames - 15.08.2015, 13:33
Re: MySQL syntax error - by finelaq - 15.08.2015, 13:35
Re: MySQL syntax error - by Syzygy1 - 15.08.2015, 14:11
Re: MySQL syntax error - by Vince - 15.08.2015, 14:19

Forum Jump:


Users browsing this thread: 1 Guest(s)