rendered paste body<?php
include('include/connect.php');
$query = "SELECT name, id FROM bixen_category";
$result = $dbcon->query($query) or die($dbcon->error);
while ($row = $result->fetch_assoc()) {
$querybil = "SELECT name, distance_km, picture_url, price_dk, fk_category_id FROM bixen_cars WHERE fk_category_id ='" . $row['id'] . "' ORDER BY rand() LIMIT 1";
$result2 = $dbcon->query($querybil) or die($dbcon->error);
while ($row2 = $result2->fetch_assoc()) {
echo '<div class=randbil>';
echo "<img src='images/biler/" .$row2['picture_url'] . "' style='margin-top:10px; border-radius:10px;'width='200' height='120'>";
echo '<ul><li>';
echo "<a href=''><h1>" .$row['name']. "</h1></a>";
echo '</li><li>';
echo $row2['name'];
echo '</li><li>';
echo "Antal Km:";
echo " ";
echo $row2['distance_km'];
echo '</li><li>';
echo "Pris:";
echo " ";
echo $row2['price_dk'] . ",- Kr";
echo '</li></ul>';
echo '</div>';
}
}
?>