MySQL error
#1

so i created /oban command and this is what i get when i try it


Код:
[MySQL] Error (0): Could not execute query. Column count doesn't match value count at row 1.
Код:
COMMAND:oban(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 5)
		{
			new otherID, playerName[24], adminName[24], reason[300];

			if(sscanf(params, "us[300]", playerName, reason))
			{
				SendClientMessage(playerid, COLOR_WHITE, "{FF0770}[Admin] Usage: \"oban <playername> <reason>\"");
			}
			else
			{
							new aMsg[300];
							GetPlayerName(playerid, adminName, sizeof(adminName));
							new log[250];
							format(log, sizeof(log), "%s(%i) has offline banned %s(%i)", playerData[playerid][tempAdminName], playerid, playerName, playerName);
							SendAdminText(playerid, log);
							
							new banreason[350];
							format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`) VALUES ('%s', '%s', '%s')", adminName, reason, playerName);
							mysql_query(banreason, MYSQL_ADD_BAN, playerid, connection);
							
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
		
	return 1;
}
Reply
#2

Read following documentation:
INSERT INTO
MySQL Tutorial
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)