我还需要使用mysqli_query($ connection,$ results);和mysqli_close($ connection); ?
$sql = $connection->prepare("INSERT INTO pawnshop ".
"(Pawnshop_Name, Street, Barangay, City, DTI_Permit_No, Mayor_Permit_No, Firstname, Middlename, Lastname, Contact_Number, Email_Address, Password) ".
"VALUES ".
"(?,?,?,?,?,?,?,?,?,?,?,?)");
$sql->bind_param("ssssiissssss", $pawnshopName, $street, $barangay, $city, $dtiPermitNo, $mayorPermitNo, $firstName, $lastName, $middleName, $contactNumber, $email, $password);
$sql->execute();
$results = $sql->get_results();
mysqli_query($connection, $results);// Do I still need this?
mysqli_close($connection); //Do I still need this
答案 0 :(得分:0)
我认为没有使用mysqli_query。你需要结束准备好的声明 通过$ stmt-> close();
并关闭连接。
by $ conn-> close();
答案 1 :(得分:0)
这部分代码足以让您完成查询数据库。
$sql = $connection->prepare("INSERT INTO pawnshop ".
"(Pawnshop_Name, Street, Barangay, City, DTI_Permit_No, Mayor_Permit_No, Firstname, Middlename, Lastname, Contact_Number, Email_Address, Password) ".
"VALUES ".
"(?,?,?,?,?,?,?,?,?,?,?,?)");
$sql->bind_param("ssssiissssss", $pawnshopName, $street, $barangay, $city, $dtiPermitNo, $mayorPermitNo, $firstName, $lastName, $middleName, $contactNumber, $email, $password);
$sql->execute();
$results = $sql->get_results();
我看到你使用mysqli_close($connection)
将OOP和程序编程方法混合在一起,即使你能做到这一点也不是一个好习惯。而是在$connection
对象中使用$connection->close()
;