I have functions page and details.php.
Functions Page:
function getDetails(){
$con = new Core();
$con->connect();
$param = $_GET['autoid'];
$sql = 'SELECT * FROM auto WHERE autoid=?';
$stmt = $con->myconn->prepare($sql);
$stmt->bind_param("i", $param);
$stmt->execute();
}
home.php:
<?php
$details = new Details();
$result = $details->showDetails();
while ($row = mysqli_fetch_assoc($result)) {
$id=$row['autoid'];
?>
<tr>
<td><?php echo '<a href="details.php?autoid='.$id.'">
<img src="data:image/jpeg;base64,'.base64_encode($row['foto'] ).'"/></a>'; ?>
</td>
</tr>
<?php }
mysqli_free_result($result);
?>
details.php:
$details = new Details();
$result = $details->getDetails();
var_dump($result);
When I'm in my home.php I press on a picture and get redirected to details.php. When I'm there I got the ID in my url and then I var dump but get returned a NULL.
And because of that my code in details.php doesn't work :
while ($row = $result) {
<tr>
<td><?php echo $row['merk']; ?> </td>
I'd really appreciate some help. Since I can't figure how to let it work. So basically I don't get anything shown on the details page. Besides a NULL of the var_dump.