function add_product( $product_name, $product_brand, $product_type,
$product_description,$product_price, $number,
$reservefee, $status,$image,$supplier_id )
{
global $data,$sth;
$con = new mysqli("localhost","root","","eeee");
$sth = $con->prepare( "INSERT INTO products
(product_name,product_brand,product_type,
product_description,product_price,number,reservefee,
status,image,supplier_id)
VALUES(0,?,?,?,?,?,?,?,?,?,?)" );
$sth->bind_param('ssssiiisbi', $product_name, $product_brand, $product_type,$product_description,$product_price, $number, $reservefee, $status,$image,$supplier_id);
$sth->execute();
$data []= array(
'product_name' => $product_name,
'product_brand' => $product_brand,
'product_type' => $product_type,
'product_description' => $product_description,
'product_price' => $product_price,
'number' => $number,
'reservefee' => $reservefee,
'status' => $status,
'image' => $image,
'supplier_id' => $supplier_id
);
}
答案 0 :(得分:2)
您在$con->prepare
中出现错误,因此false
已失败,因为它无法处理bind_param
对象,因此已返回mysqli_statement
。
尝试从准备中的VALUES子句中删除?
之一,因为您告诉mysql将11个参数插入10个列名称。