The Mysql command is set correctly, since the data is displayed correctly via print_r($ads). I pack the resulting array into $ads
Catch id
$id = htmlentities($_GET['id']);
Query DB.
SELECT
rent.id,
rent.run,
rent.year,
FROM rent
WHERE rent.id = '.$id.'
ORDER BY rent.time_upload DESC');
But through the isset function, they are not shown, no errors are displayed, nothing, just a blank page.
I output the data like this
<?php if (isset($ads)): ?>
<h3>
<?=$ads['id'];?>
<?=$ads['run'];?>
<?=$ads['year'];?>
</h3>
<?php endif; ?>
short_tags are included in PHP.
Please help solve the problem.
Advertisement
Answer
You’re not going deep enough. $ads['run'] doesn’t exist, only $ads['3625']['run'] does. Try:
<?php
foreach( $ads as $ad ) {
?>
<h3>
<?=$ad['id'];?>
<?=$ad['run'];?>
<?=$ad['year'];?>
</h3>
<?php
}