0
我有5列的表格,其中第一列是一个主键并具有AUTO_INCREMENT attribute.I正在尝试使用下面的代码行插入表匹配绑定:PHP类型定义不PARAMS
<?php
include "DBConstants.php";
$db = new DBConstants();
$connection = new mysqli($db->SERVER_NAME,$db->DB_USERNAME,$db->DB_PASSWORD,$db->DB_NAME);
$query = "INSERT INTO mailinglist (email, validationID, usRequest, isValidated) VALUES (?,?,?,?)";
$statement = $connection->prepare($query);
$email = $_GET["email"];
$validationID = openssl_random_pseudo_bytes (10, $crstrong);
$usRequest=false;
$isValidated = false;
$statement->bind_param($email,$validationID,$usRequest,$isValidated);
$statement->execute();
$statement->close();
$connection->close();
$array = array("result"=>true,"message"=>"You have successfully subscribed");
echo json_encode($array);
?>
但我得到这样的警告:
Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables
,因此该表没有被更新。任何人都可以告诉我我哪里出错了。
ThankYou。