【发布时间】:2015-07-23 03:41:26
【问题描述】:
<?php
include 'db.php';
$serial= $_POST['serial'];
$date_of_reg = $_POST['date_of_reg'];
$name = $_POST['name'];
$doc_type = $_POST['doc_type'];
$sql = "INSERT INTO clients (serial,date_of_reg,name,doc_type) VALUES ('$serial','$date_of_reg','$name', '$doc_type');";
$result = mysql_query($sql, $link);
if ($result == false) {
include "src/header.php";
include "src/mainmenu.php";
echo '<p>Error: cannot execute query</p>';
echo '<p><a href="register.php">Try again</a></p>';
include "src/footer.php";
exit;
}
else {
header('Location: private.php');
}
mysql_close($link);
?>
【问题讨论】:
-
错误是什么?
-
未知数太多。检查错误,一定有什么地方出错
-
还要确保在将输入放入查询之前对其进行清理
-
当我尝试将数据从表单添加到“串行”时,它显示 mysql 中的空行。我将“串行”类型设置为“文本”