我正在尝试向数据库表中添加标记,当我将其插入phpmyadmin中时,MySQL脚本有效,但是当我在PHP文件中执行该脚本时,出现错误:
<?php // This file gets the markers from the database table "markers" to the homepage mapbox maps
DEFINE('DB_USERNAME', 'root');
DEFINE('DB_PASSWORD', 'root');
DEFINE('DB_HOST', 'localhost:889');
DEFINE('DB_DATABASE', 'mappyn');
$database = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
// Check connection
if($database === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
} else {
echo "Connected";
}
$marker_adder = "INSERT INTO 'markers' (x, y, post_date, type, title, excerpt, author_id, publisher_id, score, views, featured) VALUES ('0', '0', '9999-12-31 23:59:59', 'war', 'Tile Name', 'no except', '0', '0', '5', '0', 'No')";
// $marker_adder = "INSERT INTO markers (x) VALUES ('0')";
if(mysqli_query($database, $marker_adder)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $marker_adder. " . mysqli_error($database);
}
// Close connection
mysqli_close($link);
?>
下面是我要插入的表:
我得到的错误是
无法执行INSERT INTO ...
有什么想法吗?