早上好,我创建了一个页面,用户可以在其中使用表格发送信息。当我使用WAMP Server时,它工作得很好,然后我开始将其上传到托管服务器,现在每次单击提交时都会出现错误。
这是错误:
这是insert-message.php:
<?php
require_once ('database.php');
if (isset($_POST['send'])) {
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$empname = $_POST['empname'];
$position = ($_POST['position']);
$account = $_POST['account'];
$platform = $_POST['platform'];
$processor = $_POST['processor'];
$ram = $_POST['ram'];
$monitor = $_POST['monitor'];
$phone = $_POST['phone'];
$headset = $_POST['headset'];
{
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$insert_query = "INSERT INTO tbl_pcrequest (day, month, year, empname, position, account, platform, processor, ram, monitor, phone, headset)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$insert = $database->prepare($insert_query);
$insert->execute(array($day, $month, $year, $empname, $position, $account, $platform, $processor, $ram, $monitor, $phone, $headset));
echo "<script>alert('Successfully sent!'); window.location='index.php'</script>";
}
}
?>
数据库架构:
PS:我已经将所有数据库连接凭据更改为托管凭据,不用担心。
如果需要什么,请告诉我。