<code><?php echo $_POST['bookname']."<br/>"; echo $_POST['price']."<br>"; echo $_POST['type']."<br>"; $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 '添加失败'; // } ?> </code>
<code><?php echo $_POST['bookname']."<br/>"; echo $_POST['price']."<br>"; echo $_POST['type']."<br>"; $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 '添加失败'; // } ?> </code>
建议你看下 INSERT INTO 的正确写法。。
是INSERT INTO tb () VALUES ...
是 values 而不是 value
http://database.51cto.com/art/201005/202402.htm