PHP表单提交到数据库并查询 插入出错,
程序员文章站
2022-05-31 11:33:55
...
";
echo $_POST['price']."
";
echo $_POST['type']."
";
$bookname = $_POST['bookname'];
$price = $_POST['price'];
$type1 = $_POST['type'];
require_once 'conn.php';
$result = mysql_query("insert into book (`bookname`,`price`,`time`) value ('$bookname','$price','$type1')");
dump($result);
// if($result){
// echo "添加成功";
// }
// else{
// echo '添加失败';
// }
?>
回复内容:
";
echo $_POST['price']."
";
echo $_POST['type']."
";
$bookname = $_POST['bookname'];
$price = $_POST['price'];
$type1 = $_POST['type'];
require_once 'conn.php';
$result = mysql_query("insert into book (`bookname`,`price`,`time`) value ('$bookname','$price','$type1')");
dump($result);
// if($result){
// echo "添加成功";
// }
// else{
// echo '添加失败';
// }
?>
建议你看下 INSERT INTO 的正确写法。。
是INSERT INTO tb () VALUES ...
是 values 而不是 value
http://database.51cto.com/art/201005/202402.htm