列の値を取得しようとしています dateTime そして、それらの値を使用して、その日に行われたエントリの数を取得します。したがって、bind_param に配列を渡しています。しかし、ここでエラーが発生します:
「mysqli_stmt_bind_param() へのパラメータ 3 は参照であると予想されます」
コメント付きの方法も試しましたが、どちらもうまくいかないようです。コードは次のとおりです。
<?php
$hostname = "localhost";
$database = "ti_project";
$username = "root";
$password = "";
$mysqli = new mysqli($hostname, $username, $password, $database);
$query = "SELECT dateTime FROM feedback";
$result = $mysqli->prepare($query);
/*$result->bind_param('s', $datetime);*/
$result->execute();
$result->bind_result($Date);
while ($result->fetch()){
$feedbackdate[] = array($Date);
}
$type="s";
$query = "SELECT COUNT(*) FROM feedback WHERE dateTime = ?";
$result = $mysqli->prepare($query);
call_user_func_array('mysqli_stmt_bind_param',
array_merge (array($result, $type),$feedbackdate));
$result->execute();
/*$ref = new ReflectionClass('mysqli_stmt');
$method = $ref->getMethod("bind_param");
$method->invokeArgs($result,$feedbackdate);
$result->execute();
*$result->bind_*result($count);*/
while ($result->fetch()){
$Count[] = array(
'Count' => $count
);
}
echo json_encode($Count);
$result->close();
$mysqli->close();
?>