我实际上尝试mysqli->fetch_array();
获取数组但无法正常工作,所以我使用了 bind_result(); 它抛出以下错误
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement
所以我对 bind_result 进行了错误检查,我得到的是bind_result() failed:
我真正做错了什么?
$wtf = "";
$hello = "";
$check_empty_field = $mysqli - > prepare("select `username`, `firstname`, `lastname` from `vpb_uploads` where `username` = ? and `firstname` = ? and `lastname` = ?");
$check_empty_field - > bind_param('sss', $username, $wtf, $hello);
$check_empty_field - > execute();
$check_empty_field - > store_result();
if($check_empty_field - > num_rows < 1) {
$date = date("d-m-Y");
$i2 = '';
$i3 = '';
$i4 = '';
$i5 = '';
$insert = $mysqli - > prepare("insert into `vpb_uploads` (`username`, `firstname`, `lastname`, image_one, image_two, image_three, image_four, image_five, date)values(?,?,?,?,?,?,?,?,?)");
$insert - > bind_param('sssssssss', $username, $wtf, $hello, $random_name_generated, $i2, $i3, $i4, $i5, $date);
$insert - > execute();
$identity = "image_one";
} else {
$get_empty_field = $check_empty_field - > bind_result($username, $wtf, $hello);
if(false === $get_empty_field) {
die('bind_result() failed: '.htmlspecialchars($mysqli - > error));
}
$image_one = strip_tags($get_empty_field["image_one"]);
$image_two = strip_tags($get_empty_field["image_two"]);
$image_three = strip_tags($get_empty_field["image_three"]);
$image_four = strip_tags($get_empty_field["image_four"]);
$image_five = strip_tags($get_empty_field["image_five"]);
global $identity;
}