我正在尝试将这6个值插入数据库。我正在准备插入它们的语句,但是当我执行它时,什么也没有发生,并且返回false。
我正在从html页面获取值
然后与我创建的数据库建立连接,现在我要执行我创建的数据库的语句
请告知
这是为了学习的目的,我仍然是新手 谢谢
<?php
$pname=$_POST['pname'];
$fname=$_POST['fname'];
$year=$_POST['year'];
$email=$_POST['email'];
$psw=$_POST['psw'];
$psw_r=$_POST['psw-repeat'];
$r=0;
$servername = "localhost";
$username = "x";
$password = "y";
$dbname = "yyports";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$stmt = mysqli_prepare($conn, "INSERT INTO users(PersonName,FamilyName,yearOfBirth,Email,Password,NumberOfKneyot)VALUES(?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt,"ssissi",$pname, $fname, $year, $email, $ps,$r);
if(!mysqli_stmt_execute($stmt)){
echo("mahmood");
}
mysqli_close($conn);
?>
预期在数据库中输入值