SQL-数据库连接成功,数据插入失败

时间:2019-06-24 04:37:43

标签: php sql

能够成功连接到数据库,但是即使在本地测试数据库上成功执行相同的代码,数据也不会通过插入输入。

下面是我尝试过的两个准备好的语句选项-第一个已成功将数据添加到本地测试数据库上的表中:

//首次尝试:

$stmt = $conn -> prepare ("INSERT INTO SignUps (TimeStamp, Name, Email, password, DoB, Postcode) VALUES (?, ?, ?, ?, ?, ?)");
$stmt -> bind_param("sssssi", $date, $filter_Name, $filter_Email, $filter_password, $filter_DoB, $filter_Postcode);

$insert = $stmt -> execute(); 

//第二次尝试:

$stmt = mysqli_prepare ($conn, "INSERT INTO `SignUps` (`TimeStamp`, `Name`, `Email`, `password`, `DoB`, `Postcode`) VALUES (?, ?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, "sssssi", $date, $filter_Name, $filter_Email, $filter_password, $filter_DoB, $filter_Postcode);

$insert = mysqli_stmt_execute($stmt);

//当前在测试中出现错误:

if(mysqli_stmt_execute($stmt)){

0 个答案:

没有答案