这个问题在这里已经有答案了:
引用-这个错误在php中是什么意思(36个答案)
两年前关门了。
我需要支持请,我的php文件不能插入post数据从一个窗体到sql,但当我使用常量值而不是 $_POST['name']
它起作用了。
<?php
$servername = "localhost";
$username = "hostingo_usrproj";
$password = "basel1990!";
$dbname = "hostingo_project";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name =$_POST['name'];
$email =$_POST{'email'];
$usrpassword =$_POST['usrpassword'];
$mobile =$_POST['mobile'];
$sql = "INSERT INTO MyGuests (name, email, usrpassword, mobile )
VALUES ('$name', '$email', '$usrpassword', '$mobile')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
1条答案
按热度按时间2wnc66cl1#
根据我的想法这里是问题,试试这个