我在将数据插入 Access 表(“测试”)时遇到问题。我有一个 html 表单,应该使用我的 PHP 来插入。一切似乎都正常(没有错误),但是当我查看我的 Access 表(“测试”)时,没有插入任何内容,我不知道为什么。SELECT 工作正常,由于某种原因我无法插入。
谢谢您的帮助。
测试.html:
<html>
<body>
Enter Customer Information
<br>
(* indicates required fields)
<p>
<form action="test.php" method="post">
Last Name*: <input type="text" name="last">
<br>
First Name*: <input type="text" name="first">
</td>
</tr>
<input type="submit">
</form>
</body>
</html>
测试.php:
<?php
$conn=odbc_connect('testdb','','');
$sql="INSERT INTO test (last, first)
VALUES
('$_POST[last]','$_POST[first]')" or die (sql_error);
odbc_exec($conn, $sql) or die (exec_error);
odbc_commit($conn) or die (comm_error);
odbc_close($conn);
echo "1 record added";
?>