MySQL Error 1064
#1

Right, I'm back.... Again.

This time, I'm getting this error from mysql:

Code:
(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 'Bella', 'Hi', NOW(), '1438149775', 1)' at line 1
This is the piece of my code generating this error:

Code:
	
mysql_format(mysql, query, sizeof(query), "INSERT INTO `bandata` (`BanUser`, `BanIP`, `BanBy`, `BanReason`, `BanOn`, `UnbanOn`, `BanStatus`) VALUES ('%e', '%s`, '%e', '%s', NOW(), '%i', 1)", Name[banID], IP[banID], Name[playerid], bReason, bTime);
Any help would be appreciated, in case your wondering, the entire function is this:

Code:
CMD:ban(playerid,params[]) {
	new banID, bReason[60], bTime, days, hours, minutes, seconds;
	if(!IsPlayerAdmin(playerid) && pInfo[playerid][AdminLvl] < 2) return 0;
	if(sscanf(params, "udddds[60]", banID, days, hours, minutes, seconds, bReason)) return SendClientMessage(playerid, -1, "USAGE: /ban [playerid][days][hours][minutes][seconds][reason(OPTIONAL)]");
	if(!IsPlayerConnected(banID)) return SendClientMessage(playerid, -1, "ERROR: Invalid player name/ID!");
	if(pInfo[playerid][AdminLvl] < pInfo[banID][AdminLvl]) return SendClientMessage(playerid, -1, "You cannot ban an admin higher in rank than yourself!");
	format(query, sizeof(query), "You've been banned by staff member: %s(%d) for %d days, %d hours, %d minutes and %d seconds. Reason: %s", Name[playerid], playerid, days, hours, minutes, seconds, bReason);
	SendClientMessage(banID, -1, query);
	format(query, sizeof(query), "Admin %s(%d) has banned %s(%d) for: %d days, %d hours, %d minutes and %d seconds. Reason: %s", Name[playerid],playerid, Name[banID], banID, days, hours, minutes, seconds, bReason);
	SendClientMessageToAll(-1, query);
	minutes = minutes*60;
	hours = hours*3600;
	days = days*86400;
	bTime = seconds+minutes+hours+days;
	bTime = gettime()+bTime;
	mysql_format(mysql, query, sizeof(query), "INSERT INTO `bandata` (`BanUser`, `BanIP`, `BanBy`, `BanReason`, `BanOn`, `UnbanOn`, `BanStatus`) VALUES ('%e', '%s`, '%e', '%s', NOW(), '%i', 1)", Name[banID], IP[banID], Name[playerid], bReason, bTime);
	mysql_tquery(mysql, query, "", "");
	KickWithDelay(banID);
	return 1;
}
I know, probably not that efficient, but, best I can come up with when it's midnight.

Any help would be appreciated, since I'm a total newb at error-handling in MySQL, cheers!

I'm out, need sleep.
Reply
#2

Nevermind, I fixed it, must've been having a bad night haha.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)