dongliang1654 2017-03-12 21:48
浏览 70

尝试运行INSERT命令时出现错误:1064 [重复]

Let me start off by saying that if my question has already been answered, please point me to the answer as I have been unable to locate a viable solution to my problem.

I am trying to insert information submitted from a form into a table within a database. I am able to connect to the database just fine but when I try to run the INSERT SQL command, it spits out and error message. All that I am getting is: "Error: INSERT INTO 008181 (userID, calibration, dayName, date, time, bottomAirTemp, topAirTemp, meatTemp, cheeseTemp, walkinTemp, refrig1Temp, refrig2Temp, refrig3Temp, freeze1Temp, freeze2Temp, freeze3Temp, saladAirTemp, saladCheeseTemp, wingTemp, sauceTemp, buffPizzaTemp, hotHold, pizzaTemp, pastaTemp, topOvenTemp, topOvenSpeed, centerOvenTemp, centerOvenSpeed, bottomOvenTemp, bottomOvenSpeed, greenPepperDate, mushroomDate, onionDate, approvedProduct, expiredProduct, rawZoneProcess, fifoProcess, produceWashed, hotWater, ppmLevel, highTempWasher, lowTempWasher, chemicalsStored, illTeamMembers, handWashing, waterTemp, sinksStocked, hairRestraints, pestProvention) VALUES ('GW', 'yes', 'Sunday', 'March 12', '2:34:24 PM', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', '34', 'yes', '34', '34', '', '', '', '', '', '', '', '', '', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes') 1064 ". Part of my INSERT command is being filled in by a PhP variable, however the variable is putting the correct information into the command.

The following is my php commands:

$sql = "INSERT INTO $storeNumber (userID, calibration, dayName, date, time, bottomAirTemp, topAirTemp, meatTemp, cheeseTemp, walkinTemp, refrig1Temp, refrig2Temp, refrig3Temp, freeze1Temp, freeze2Temp, freeze3Temp, saladAirTemp, saladCheeseTemp, wingTemp, sauceTemp, buffPizzaTemp, hotHold, pizzaTemp, pastaTemp, topOvenTemp, topOvenSpeed, centerOvenTemp, centerOvenSpeed, bottomOvenTemp, bottomOvenSpeed, greenPepperDate, mushroomDate, onionDate, approvedProduct, expiredProduct, rawZoneProcess, fifoProcess, produceWashed, hotWater, ppmLevel, highTempWasher, lowTempWasher, chemicalsStored, illTeamMembers, handWashing, waterTemp, sinksStocked, hairRestraints, pestProvention)
VALUES ('$userID', '$calibration', '$dayName', '$date', '$time', '$bottomAirTemp', '$topAirTemp', '$meatTemp', '$cheeseTemp', '$walkinTemp', '$refrig1Temp', '$refrig2Temp', '$refrig3Temp', '$freeze1Temp', '$freeze2Temp', '$freeze3Temp', '$saladAirTemp', '$saladCheeseTemp', '$wingTemp', '$sauceTemp', '$buffPizzaTemp', '$hotHold', '$pizzaTemp', '$pastaTemp', '$topOvenTemp', '$topOvenSpeed', '$centerOvenTemp', '$centerOvenSpeed', '$bottomOvenTemp', '$bottomOvenSpeed', '$greenPepperDate', '$mushroomDate', '$onionDate', '$approvedProduct', '$expiredProduct', '$rawZoneProcess', '$fifoProcess', '$produceWashed', '$hotWater', '$ppmLevel', '$highTempWasher', '$lowTempWasher', '$chemicalsStored', '$illTeamMembers', '$handWashing', '$waterTemp', '$sinksStocked', '$hairRestraints', '$pestPrevention')";

if (mysqli_query($conn, $sql)) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br/>" . mysqli_errno($conn);
}

I am not sure of where my sql is going wrong as this error is only spitting out the same information which I am putting into the command.

Again, I am able to connect to the database just fine, and the database has tables set up to correspond to all possible $storeNumbers that can be selected within the submitting form. When setting up the command at first, I did not have any form of quot marks around the column names within the table. I have even tried to grab the sql code directly from phpmyadmin and only change the referring table name to the corresponding variable.

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 MATLAB中streamslice问题
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序