gpt4 book ai didi

php - 回显不成功的错误

转载 作者:搜寻专家 更新时间:2023-11-01 09:35:56 26 4
gpt4 key购买 nike

<分区>

下面的代码应该连接到一个应用程序,并将用户输入的数据插入到数据库中。但是,当我运行代码时出现一个奇怪的错误,它显示“解析错误:语法错误,意外的‘插入’...”。对我来说,这个错误告诉我 echo “插入成功”以某种方式导致代码崩溃,我是不是误解了错误的意思?有人可以告诉我如何修复代码吗?

<?php
require "conn.php";

$patient_name = $_POST["patient_name"];
$doctor_name = $_POST["doctor_name"];
$check_in_date = $_POST["check_in_date"];
$room_number = $_POST["room_number"];
$bed_number = $_POST["bed_number"];
$notes = $_POST["notes"];
$time = $_POST["time"];

$mysql_qry = "insert into patients2
(patient_name, doctor_name, check_in_date, room_number, bed_number, notes, time)
values ('$patient_name', '$doctor_name', '$check_in_date', '$room_number', '$bed_number', '$notes', '$time';);

if($conn->query($mysql_qry) === TRUE) {
echo "Insert successful";
}
else{
echo "Error: " . $mysql_qry . "<br>" . $conn->error;
}
$conn->close();
?>

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com