I wanted to select data from MYSQL database. For that I did the following:
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
mysqli_set_charset($mysqli, "utf8");
date_default_timezone_set("Europe/Berlin");
session_name('User Session');
session_start();
$private_id = session_id();
$private_questions = get_questions($mysqli);
session_write_close();
function get_questions($mysqli, $stmt_get_questions) {
$stmt = $mysqli->query($stmt_get_questions);
$questions = array();
while($question = $stmt->fetch_assoc()) {
$questions[] = $question;
}
$stmt->close();
$mysqli->close();
return $questions;
}
And call my variable in HTML:
<div class="container">
<p>Private ID is <?=$private_id?></p>
<p>Questions <?=$private_questions?></p>
</div>
But I get an internal server error:
GET mywebsite/myhtml.html 500 (Internal Server Error)
I can't find the problem. The MYSQL Select is correct.