$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$com_name=$_POST['com_name'];
$industry_ID=$_POST["industry"];
$email=$_POST["email"];
$con_num=$_POST["con_num"];
$ori_comname=$_POST["ori_com"];
$stml =$conn->prepare( "UPDATE client_info SET
company_name=:com_name,
industry_ID=:industry_id,
email=:email,
contact_num=:cin_num
WHERE company_name=:ori_com");
$stmt->bindParam(':com_name', "$com_name");
$stmt->bindParam(':industry_id', $industry_ID);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':cin_num', $con_num);
$stmt->bindParam(':ori_com', $ori_comname);
$stmt->execute();
大家好,我得到错误未定义变量,并在执行时调用非对象上的成员函数bindParam()。请指教。谢谢你。
答案 0 :(得分:0)
您在变量名称中输入了错误。
你有:
$stml =$conn->prepare ...
但它应该是:
$stmt =$conn->prepare ...