<分区>
Error: INSERT INTO grocery ('GrocerID', 'GrocerName', 'Address', 'LogoImage') VALUES ('GID0072', 'BigBazaar','India, Andhra Pradesh, 522124','WIN_20150817_121614.JPG') 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 ''GrocerID', 'GrocerName', 'Address', 'LogoImage') VALUES ('GID0072', 'BigBazaar' at line 1
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$dbname = "task";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$GrocerID=$_POST['GrocerID'];
$GrocerName=$_POST['GrocerName'] ;
$Address=$_POST['Address'];
$LogoImage=$_POST['LogoImage'] ;
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO grocery ('GrocerID', 'GrocerName', 'Address', 'LogoImage')
VALUES ('$GrocerID', '$GrocerName','$Address','$LogoImage')";
if ($conn->query($sql) === TRUE) {
header('Location:task.html');
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
有人可以告诉我我在这里做错了什么吗??
我用过 数据库名称:任务, 表名:杂货店 但我无法理解我哪里做错了。
谢谢