Mysql SQLSTATE [21S01]:插入值列表与列不匹配

时间:2015-06-02 09:14:59

标签: mysql sql-server

我无法解决这个错误似乎对我来说一切正常,我该如何解决这个问题? 这是我的疑问:

$queryGame['selectAllCharacters']               = "SELECT  `obj_Id`,`char_name` FROM `characters` WHERE `account_name` = ?;";

这是我的表:

TABLE `characters` (

  `account_name` varchar(45) NOT NULL DEFAULT '',

  `obj_Id` int(11) NOT NULL DEFAULT '0',

  `char_name` varchar(35) CHARACTER SET utf8 NOT NULL DEFAULT '',

  `face` tinyint(3) unsigned DEFAULT NULL,

  `hairStyle` tinyint(3) unsigned DEFAULT NULL,

  `hairColor` tinyint(3) unsigned DEFAULT NULL,

  `sex` tinyint(1) NOT NULL DEFAULT '0',

  `heading` mediumint(9) DEFAULT NULL,

  `x` mediumint(9) DEFAULT NULL,

  `y` mediumint(9) DEFAULT NULL,

  `z` mediumint(9) DEFAULT NULL,

  `karma` int(11) DEFAULT NULL,

  `pvpkills` int(11) DEFAULT NULL,

  `pkkills` int(11) DEFAULT NULL,

  `clanid` int(11) DEFAULT NULL,

  `createtime` int(10) unsigned NOT NULL DEFAULT '0',

  `deletetime` int(10) unsigned NOT NULL DEFAULT '0',

  `title` varchar(16) CHARACTER SET utf8 DEFAULT NULL,

  `rec_have` tinyint(3) unsigned NOT NULL DEFAULT '0',

  `rec_left` tinyint(3) unsigned NOT NULL DEFAULT '20',

  `rec_bonus_time` int(11) NOT NULL DEFAULT '3600',

  `hunt_points` int(11) NOT NULL DEFAULT '0',

  `hunt_time` int(11) NOT NULL DEFAULT '14400',

  `accesslevel` tinyint(4) DEFAULT NULL,

  `online` tinyint(1) DEFAULT NULL,

  `onlinetime` int(10) unsigned NOT NULL DEFAULT '0',

  `lastAccess` int(10) unsigned NOT NULL DEFAULT '0',

  `leaveclan` int(10) unsigned NOT NULL DEFAULT '0',

  `deleteclan` int(10) unsigned NOT NULL DEFAULT '0',

  `nochannel` int(11) NOT NULL DEFAULT '0',

  `pledge_type` smallint(6) NOT NULL DEFAULT '-128',

  `pledge_rank` tinyint(3) unsigned NOT NULL DEFAULT '0',

  `lvl_joined_academy` tinyint(3) unsigned NOT NULL DEFAULT '0',

  `apprentice` int(10) unsigned NOT NULL DEFAULT '0',

  `key_bindings` varbinary(8192) DEFAULT NULL,

  `pcBangPoints` int(11) NOT NULL DEFAULT '0',

  `vitality` smallint(5) unsigned NOT NULL DEFAULT '20000',

  `fame` int(11) NOT NULL DEFAULT '0',

 `bookmarks` tinyint(3) unsigned NOT NULL DEFAULT '0',


  `hwid_lock` varchar(255) DEFAULT NULL,

  `LastHWID` varchar(255) DEFAULT '',

  `lastteleport` decimal(20,0) DEFAULT NULL,

  `raidkills` int(15) DEFAULT NULL,

  `soloinstance` int(15) DEFAULT NULL,

  `partyinstance` int(15) DEFAULT NULL,

  `eventkills` int(23) DEFAULT NULL,

  PRIMARY KEY (`obj_Id`),

  UNIQUE KEY `char_name` (`char_name`),

  KEY `account_name` (`account_name`),

 KEY `clanid` (`clanid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

我收到此错误日志:

  

09:05:23 02/06/2015:SQLSTATE [21S01]:插入值列表与列表列表不匹配:1136列数与第1行的值计数不匹配(2.81.122.171)

我做错了什么?

$queryLogin['checkAccount']                 = "SELECT `login`,`email` FROM `accounts` WHERE `login` = ? OR `email` = ?;";
$queryLogin['checkEmail']                   = "SELECT `email` FROM `accounts` WHERE `email` = ?;";
$queryLogin['updateEmail']                  = "UPDATE `accounts` SET `email` = ? WHERE `login` = ?;";
$queryLogin['createAccount']                    = "INSERT INTO `accounts` (`login`,`password`,`email`,`access_level`,`last_ip`) VALUES (?,?,?,?,?);";
$queryLogin['loginToAccount']                   = "SELECT `login` FROM `accounts` WHERE `login` = ? AND `password` = ?;";
$queryLogin['changePassword']                   = "UPDATE `accounts` SET `password` = ? WHERE `login` = ?;";
$queryLogin['selectAccountData']                = "SELECT `email`,`access_level`,`last_ip` FROM `accounts` WHERE `login` = ?;";
$queryLogin['updatePlayerBan']                  = "UPDATE `accounts` SET `access_level` = 0 WHERE `login` = ? AND `access_level` < -1;";

$queryLogin['disableAccount']                   = "UPDATE `accounts` SET `access_level` = -100 WHERE `login` = ?;";

$queryGame['selectAllCharacters']               = "SELECT  `obj_Id`,`char_name` FROM `characters` WHERE `account_name` = ?;";
$queryGame['selectCharacterData']               = "SELECT `char_name`,`online` FROM `characters` WHERE `account_name` = ? AND `obj_Id` = ?;";

$queryGame['selectPlayerItemData']              = "SELECT `object_id` FROM `items` WHERE `owner_id` = ? AND `item_id` = ?;";
$queryGame['updatePlayerItemCount']             = "UPDATE `items` SET `count` = count+? WHERE `object_id` = ?;";
$queryGame['addItemToPlayerInventory']              = "INSERT INTO `items` (`owner_id`,`object_id`,`item_id`,`count`,`enchant_level`,`loc`,`life_time`) VALUES (?,(SELECT MAX(object_id)+1 FROM items AS object_id),?,?,?,'INVENTORY',-1);";
$queryGame['selectAllPlayerItems']              = "SELECT `object_id`,`item_id`,`enchant_level` FROM `items` WHERE `owner_id` = ? AND `count` = 1 ORDER BY `item_id` DESC, `enchant_level` DESC;";
$queryGame['selectPlayerItemEnchantData']           = "SELECT `enchant_level`,`item_id` FROM `items` WHERE `object_id` = ? AND `owner_id` = ?;";


if (!isset($load)) exit;

if ($validate->blank($player['character']['id']))
    exit(header("Location: ?page=player"));

$subContent = "";

$characterData = $mysqlClientGameServer->select($queryGame['selectAllCharacters'],array($player['account']));

if (!$characterData)
    $subContent = "There are no created characters on this account.";
else
{
    if (isset($characterData['char_name']))
    {
        $player['character']['id'] = $characterData[0];

        exit();
        updateSession();
        exit(header("Location: ?page=player"));
    }

    foreach($characterData as $character)
    {
        $subContent .= "<button class=\"process\" title=\"character\" name=\"id\" value=\"".$character[0]."\">".$character[1]."</button>";
    }
}

$templateContent->replace("buttonset",$subContent);

这是类服务,当我使用它时,我收到错误。

0 个答案:

没有答案