Hello I am doing a shopping store project in Php.I am trying to display my products just like a shopping cart page.I did it in a list view which shows all products one below another in vertical format.I had thoughts to show in a tabular format with 4-5 products on each row as in real world shopping websites but I am getting nowhere. my code is:
<?php
$sql = 'SELECT * FROM burgers ORDER BY id';
$result = $db->query($sql);
$output = '<ul>';
while ($row = $result->fetch()) {
$output .= '<li>"'.$row['title'].'" made by </br> '.$row['chef'].': Rs '.$row['price'].'<img src="images/'.$row['image'].'" width="100" height="100" /><br />';
if (isset($_SESSION['username'])) {
$output .= '<a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';
}
else {
$output .= '<a href="login.php">Login</a></li>';
}
}
$output .= '</ul>';
echo $output;
?>