0

I SELECT two things from my database and want to give them with GET to my view side. This is how my code looks:

$query = mysqli_prepare($db, "SELECT points, userstory FROM storypoints_summary WHERE session_id = ?");
mysqli_stmt_bind_param($query, "s", $session_id);
mysqli_stmt_execute($query);
mysqli_stmt_bind_result($query, $db_point, $db_userstory);

while (mysqli_stmt_fetch($query)) {
    array_push($points, $db_point);
    array_push($userstorys, $db_userstory);
}
mysqli_close($db);

$points = implode(",", $points);
$userstorys = implode(",", $userstorys);

After this i give them as i told with GET as followed:

header("location: story_overview_view.php?points=$points&userstorys=$userstorys");
die();

Now explode them in the View:

$points = explode(",", htmlspecialchars($_GET['points']));
$userstorys = explode(",", htmlspecialchars($_GET['userstorys']));

$count = count($points);
for ($i = 0; $i < $count; $i++) {
echo $points[$i] . "<br>";
echo $userstorys[$i];
}

The problem now is, that points works, but userstorys doesn't. Both are varchars in the database. When I delete implode and explode from userstorys, then it prints Array. So thats its not an Array isn't the problem. If I delete implode and explode again and give with GET but only ...=$userstorys[0], it gives me the first and right value.

Luca F
  • 145
  • 1
  • 13

0 Answers0