[英]How to solve this type of database?
提交表單時出現此類錯誤:致命錯誤:未捕獲錯誤:調用 C:\\xampp\\htdocs\\rubina\\fuerte_developers_1\\config.php:31 中的 bool 上的成員函數 bind_param() 堆棧跟蹤:#0 {main } 扔在 C:\\xampp\\htdocs\\rubina\\fuerte_developers_1\\config.php 第 31 行
我的 config.php 代碼
<?php
session_start();
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$email= $_POST['email'];
$area_code= $_POST['area_code'];
$phone= $_POST['phone'];
$method= $_POST['method'];
$cmpny = $_POST['cmpny'];
$service= $_POST['service'];
$contact= $_POST['contact'];
$amount= $_POST['amount'];
$currency= $_POST['currency'];
$des= $_POST['des'];
$website= $_POST['website'];
$conn = new mysqli('localhost', 'root','','creative');
if($conn->connect_error){
die('connection failed : ' .$conn->connect_error);
}
else{
$stmt = $conn->prepare("insert into creative(fname,lname,email,area_code,phone,method,cmpny,service,contact,amount,currency,des,website) values(?,?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param("sssssssssssss", $fname,$lname,$email,$area_code,$phone,$method,$cmpny,$service,$contact,$amount,$currency,$des,$website);
$stmt->execute();
$stmt->close();
$conn->close();
}
$_SESSION["id"]=1;
header('location:index.php');
?>```
該錯誤意味着$stmt
不是您認為的那樣。 它不是一個對象 - 現在它是false
因為在准備語句時出現錯誤,這意味着您的 SQL 已關閉。
我的猜測是您的一個字段拼寫錯誤(可能是cmpny
字段?)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.