I have made a database and connected it properly. I am trying to display the database contents to be side by side. I have tried to create a div but everything is jumbled up. The items are floating left but are not showing up side by side.
<html>
<head>
<style>
.menu{
float:left;
}
p{
text-align:left;
float:left;
inline-size:300px;
overflow:hidden;
}
</style>
</head>
<body>
<main>
<section>
<h3>Inventory</h3>
<?php include 'db.php';
$ID = $_GET['ID'];
$query = "SELECT * FROM inventory ORDER BY ID";
/* Try to query the database */
if ($result = $mysqli->query($query)) {
// Don't do anything if successful
}
else
{
echo "Sorry, an item with the ID of $ID cannot be found " . mysql_error()."<br>";
}
while ($result_ar = mysqli_fetch_assoc($result)) {
//Display food image and image source
$image = $result_ar['Image'];
echo "<div class = 'menu'>" . $result_ar['Image_Source'] . "<br>".
"<IMG src= 'images/$image' style = height:200px; width:300px;>". "</div>";
//Display name and description
echo "<p>".$result_ar['Name'] . "<br>"
. $result_ar['Description'] ."</p>";
}
$mysqli->close();
?>
</section>
</main>
</body>
</html>