<?php
$link = mysqli_connect($db_host, $db_user, $db_password, $db_database)
or die("Ошибка " . mysqli_error($link));
$query ="SELECT * FROM book ORDER BY id ";
$result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));
if (mysqli_num_rows($result) > 0)
{
$row = mysqli_fetch_array($result);
do
{
$img_pathh = 'uploads_images/'.$row["image"];
echo '
<div class="row justify-content-center">
<div class="col-md-4 books-content-img">
<a href="book.html"><img src="'.$img_pathh.'"/></a>
</div>
<div class="col-md-5 books-annotation">
<div class="books-annotation-content">
<div class="books-annotation-title">
<h2><a href="book.php">'.$row["title"].'</a></h2>
<p>Жанр: <span>'.$row["genre"].'</span></p>
<p>Возрастное ограничение: <span>'.$row["age"].'</span></p>
</div>
<div class="books-annotation-text">
<p>'.$row["miniannotation"].'</p>
</div>
</div>
<div class="books-annotation-read">
<h3>Купить и читать:</h3>
<ul class="hr">
';
$query1 ="SELECT * FROM book WHERE id='$id' ";
$result1 = mysqli_query($link, $query1) or die("Ошибка " . mysqli_error($link));
if (mysqli_num_rows($result1) > 0)
{
$query1 ="SELECT * FROM tovar WHERE products_id='$id' ";
$result1 = mysqli_query($link, $query1) or die("Ошибка " . mysqli_error($link));
if (mysqli_num_rows($result1) > 0)
{
$row1 = mysqli_fetch_array($result1);
do
{
echo '
<li><a href="'.$row1["tovar"].'" target="_blank">'.$row1["many"].'</a></li>
';
} while ($row1 = mysqli_fetch_array($result1));
} }
echo '
</ul>
</div>
</div>
</div>
';
}
while ($row = mysqli_fetch_array($result));
}
?>