I am trying to print my result data returned from the fetchAll function. How can i bind the name and desc variable to the returned results.
<?php
$get = $db->prepare("SELECT * FROM Products ORDER BY DateAdded DESC LIMIT 4");
$get->execute();
$results = $get ->fetchAll();
foreach($results as $result){ ?>
$name = $result['Name'];
$desc= $result['Desc'];
<h4><?php echo $name ?></h4>
<h4><?php echo $desc?></h4>
<?php
}
?>
?>should be after$desc= $result['Desc'];. Make an effort, learn php syntax carefully.