查询不插入而不显示错误

时间:2017-08-19 17:45:06

标签: php mysql

我一直试图解决这个问题,并且无法使其发挥作用。我试图看到我的PHP的响应,但它没有显示任何错误。上次插入我的表格。下面是我的PHP查询。

$selectCharacter = $con->query('SELECT * FROM users_characters WHERE UserId = "'. $UserID .'" AND CharacterID = "'. $CharacterID .'"');
$user_data = $selectCharacter->fetch_assoc();
$CharacterID = $user_data['CharacterID'];
$UserID = $user_data['UserId'];
$Name = $user_data['Name'];
$Hash = $user_data['Hash'];
$HairID = $user_data['HairID'];
$Access = $user_data['Access'];
$SkillPoints = $user_data['SkillPoints'];
$RaceID = $user_data['RaceID'];
$RaceXP = $user_data['RaceXP'];
$ActivationFlag = $user_data['ActivationFlag'];
$PermamuteFlag = $user_data['PermamuteFlag'];
$Country = $user_data['Country'];
$Age = $user_data['Age'];
$Gender = $user_data['Gender'];
$Email = $user_data['Email'];
$Level = $user_data['Level'];
$Copper = $user_data['Copper'];
$Silver = $user_data['Silver'];
$Gold = $user_data['Gold'];
$Coins = $user_data['Coins'];
$Exp = $user_data['Exp'];
$ColorHair = $user_data['ColorHair'];
$ColorSkin = $user_data['ColorSkin'];
$ColorEye = $user_data['ColorEye'];
$ColorBase = $user_data['ColorBase'];
$ColorTrim = $user_data['ColorTrim'];
$ColorAccessory = $user_data['ColorAccessory'];
$SlotsBag = $user_data['SlotsBag'];
$SlotsBank = $user_data['SlotsBank'];
$SlotsHouse = $user_data['SlotsHouse'];
$DateCreated = $user_data['DateCreated'];
$LastLogin = $user_data['LastLogin'];
$CpBoostExpire = $user_data['CpBoostExpire'];
$RepBoostExpire = $user_data['RepBoostExpire'];
$GoldBoostExpire = $user_data['GoldBoostExpire'];
$ExpBoostExpire = $user_data['ExpBoostExpire'];
$UpgradeExpire = $user_data['UpgradeExpire'];
$UpgradeDays = $user_data['UpgradeDays'];
$Upgraded = $user_data['Upgraded'];
$Achievement = $user_data['Achievement'];
$Settings = $user_data['Settings'];
$Quests = $user_data['Quests'];
$Quests2 = $user_data['Quests2'];
$DailyQuests0 = $user_data['DailyQuests0'];
$DailyQuests1 = $user_data['DailyQuests1'];
$DailyQuests2 = $user_data['DailyQuests2'];
$MonthlyQuests0 = $user_data['MonthlyQuests0'];
$LastArea = $user_data['LastArea'];
$SpawnPoint = $user_data['SpawnPoint'];
$CurrentServer = $user_data['CurrentServer'];
$HouseInfo = $user_data['HouseInfo'];
$KillCount = $user_data['KillCount'];
$DeathCount = $user_data['DeathCount'];
$Address = $user_data['Address'];
$Language = $user_data['Language'];
$Rebirth = $user_data['Rebirth'];
$Bounty = $user_data['Bounty'];

$backupCharacter = $con->query("INSERT INTO `users_characters_history` 
            (`CharacterID`, `UserId`, `Name`, `Hash`, `HairID`, 
            `Access`, `SkillPoints`, `RaceID`, `RaceXP`, 
            `ActivationFlag`, `PermamuteFlag`, `Country`, 
            `Age`, `Gender`, `Email`, `Level`, `Copper`, `Silver`,
            `Gold`, `Coins`, `Exp`, `ColorHair`, `ColorSkin`, 
            `ColorEye`, `ColorBase`, `ColorTrim`, `ColorAccessory`,
            `SlotsBag`, `SlotsBank`, `SlotsHouse`, `DateCreated`, 
            `LastLogin`, `CpBoostExpire`, `RepBoostExpire`, 
            `GoldBoostExpire`, `ExpBoostExpire`, `UpgradeExpire`, 
            `UpgradeDays`, `Upgraded`, `Achievement`, `Settings`, 
            `Quests`, `Quests2`, `DailyQuests0`, `DailyQuests1`, 
            `DailyQuests2`, `MonthlyQuests0`, `LastArea`, `SpawnPoint`, 
            `CurrentServer`, `HouseInfo`, `KillCount`, `DeathCount`, 
            `Address`, `Language`, `Rebirth`, `Bounty`) 
    VALUES ('" . $CharacterID . "', '" . $UserID . "', '" . $Name ."', '"
            . $Hash . "', '" . $HairID . "', '" . $Access . "', '" 
            . $SkillPoints . "', '" . $RaceID . "', '" . $RaceXP 
            . "', '" . $ActivationFlag . "', '" . $PermamuteFlag . "', '" 
            . $Country . "', '" . $Age . "', '" . $Gender ."', '" . 
            $Email . "', '" . $Level . "', '" . $Copper . "', '" . 
            $Silver . "', '" . $Gold . "', '" . $Coins . "', '" . $Exp . 
            "', '" . $ColorHair . "', '" . $ColorSkin . "',  '" . 
            $ColorEye . "', '" . $ColorBase . "', '" . $ColorTrim . "', 
            '" . $ColorAccessory . "', '" . $SlotsBag . "', '" . 
            $SlotsBank . "','" . $SlotsHouse . "', '" . $DateCreated . 
            "', '" . $LastLogin . "', '" . $CpBoostExpire . "', '" . 
            $RepBoostExpire . "', '" . $GoldBoostExpire . "', '" . 
            $ExpBoostExpire . "', '" . $UpgradeExpire . "', '" . 
            $UpgradeDays . "', '" . $Upgraded ."', '" . $Achievement . 
            "', '" . $Settings . "', '" . $Quests . "', '" . $Quests2 . 
            "', '" . $DailyQuests0 . "', '" . $DailyQuests1 . "', '" . 
            $DailyQuests2 . "', '" . $MonthlyQuests0 . "', '" . $LastArea 
            . "', '" . $SpawnPoint . "', '" . $CurrentServer . "', '" . 
            $HouseInfo . "', '" . $KillCount . "', '" . $DeathCount . "', 
            '" . $Address . "', '" . $Language . "', '" . $Rebirth . "', 
            '" . $Bounty ."')");

这是应插入但不会插入的查询,Chrome中的网络日志不会显示我的查询错误。

$backupCharacter = $con->query("INSERT INTO `users_characters_history` (`CharacterID`, `UserId`, `Name`, `Hash`, `HairID`, `Access`, `SkillPoints`, `RaceID`, `RaceXP`, `ActivationFlag`, `PermamuteFlag`, `Country`, `Age`, `Gender`, `Email`, `Level`, `Copper`, `Silver`, `Gold`, `Coins`, `Exp`, `ColorHair`, `ColorSkin`, `ColorEye`, `ColorBase`, `ColorTrim`, `ColorAccessory`, `SlotsBag`, `SlotsBank`, `SlotsHouse`, `DateCreated`, `LastLogin`, `CpBoostExpire`, `RepBoostExpire`, `GoldBoostExpire`, `ExpBoostExpire`, `UpgradeExpire`, `UpgradeDays`, `Upgraded`, `Achievement`, `Settings`, `Quests`, `Quests2`, `DailyQuests0`, `DailyQuests1`, `DailyQuests2`, `MonthlyQuests0`, `LastArea`, `SpawnPoint`, `CurrentServer`, `HouseInfo`, `KillCount`, `DeathCount`, `Address`, `Language`, `Rebirth`, `Bounty`) 
VALUES ('" . $CharacterID . "', '" . $UserID . "', '" . $Name ."', '" . $Hash . "', '" . $HairID . "', '" . $Access . "', '" . $SkillPoints . "', '" . $RaceID . "', '" . $RaceXP . "', '" . $ActivationFlag . "', '" . $PermamuteFlag . "', '" . $Country . "', '" . $Age . "', '" . $Gender ."', '" . $Email . "', '" . $Level . "', '" . $Copper . "', '" . $Silver . "', '" . $Gold . "', '" . $Coins . "', '" . $Exp . "', '" . $ColorHair . "', '" . $ColorSkin . "',  '" . $ColorEye . "', '" . $ColorBase . "', '" . $ColorTrim . "', '" . $ColorAccessory . "', '" . $SlotsBag . "', '" . $SlotsBank . "','" . $SlotsHouse . "', '" . $DateCreated . "', '" . $LastLogin . "', '" . $CpBoostExpire . "', '" . $RepBoostExpire . "', '" . $GoldBoostExpire . "', '" . $ExpBoostExpire . "', '" . $UpgradeExpire . "', '" . $UpgradeDays . "', '" . $Upgraded ."', '" . $Achievement . "', '" . $Settings . "', '" . $Quests . "', '" . $Quests2 . "', '" . $DailyQuests0 . "', '" . $DailyQuests1 . "', '" . $DailyQuests2 . "', '" . $MonthlyQuests0 . "', '" . $LastArea . "', '" . $SpawnPoint . "', '" . $CurrentServer . "', '" . $HouseInfo . "', '" . $KillCount . "', '" . $DeathCount . "', '" . $Address . "', '" . $Language . "', '" . $Rebirth . "', '" . $Bounty ."')");

1 个答案:

答案 0 :(得分:0)

感谢大家,$ con>错误显示错误,我能够解决问题,该列只接受6个字符,而我插入的那个是ColorHair有9个字符,我更改了它长度,并能够插入项目。