I´m executing a mysqli statement in a php file, and I want to pass the results to another php page. I´m storing the result in a session variable, but when I tried to show them in the second php page it appears this error:
Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result
First php file:
$stmt->execute();
$result = $stmt->get_result();
$_SESSION['result'] = $result;
Second php page:
<tbody>
<?php
while ($row = $_SESSION['result']->fetch_array(MYSQLI_NUM)) {
foreach ($row as $r) {
?>
<tr>
<td><input type="radio" name="selected" id="selected" checked="checked"></td>
<td> <?php
if (isset($_SESSION['num'])) {
echo $_SESSION['num'];
}
?></td>
<td>4</td>
<td>430</td>
<td>648</td>
<td>1,055</td>
<td>-60</td>
<td>6,448</td>
<td>7,521</td>
<td>0,561</td>
</tr>
<?php
}
}
?>
</tbody>
I have tried to show the results in the first php page with the same form that I want to show them in the second and it works, but when I do it in the second page it doesn´t work