0
我從perfectly..but與BIND_PARAM()用事先準備好的聲明的問題,收到HTML form..the值收到我的價值?可我使用PHP 7.0.1版本我在這個MySQL查詢中遇到了這個錯誤?
<?php
if(isset($_POST['submit']))
{
if(empty(($_POST['fname'])) && empty(($_POST['lname'])) && empty(($_POST['dg'])))
{
header("Location:view.html/form.html");
}
else
{
$f_name=addslashes($_POST['fname']);
$l_name=addslashes($_POST['lname']);
$post=addslashes($_POST['dg']);
}
//----------------connection to database using Pdo------------------
$hostname="localhost";
$uname="root";
$password="";
$database_name="test";
$conn= new mysqli($hostname,$uname,$password) or die("cannot connect to database Mysql");
$stm=$conn->prepare("insert into s_detail(F_Name,L_Name,Designation) values(?,?,?)");
$stm->bind_param("sss",$f_name,$l_name,$post);
//set parameter and execute
$f_name=addslashes($_POST['fname']);
$l_name=addslashes($_POST['lname']);
$post=addslashes($_POST['dg']);
if($stm->execute())
{
$stm->close();
echo "data is inserted successfully";
}
else
{
echo "failed to insert";
}
}
else
{
echo "Don't be oversmart with me";
}
?>
的誤差。 ..
Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in C:\xampp_7\htdocs\oops in php\oops.php:24 Stack trace: #0 {main} thrown in C:\xampp_7\htdocs\oops in php\oops.php on line 24
plz幫助.....