Hello, there was a problem with the logic of data output to the page. It is necessary that certain records from the database are displayed on the page in a certain "category". I tried to achieve this in the following way: I assigned each entry the ID of the category to which it belongs and if it checked if the following code came out:
<?php while ( $row = mysql_fetch_assoc($sql_response) ): $is_stock = isStock($row['stock']) ?> <h3 class="page-header"> PKVZ </h3> <?php if($row['social'] == 1){ echo showGoods($row['id'], $row['name'], $row['price'], $row['quanity'], $row['stock'], $is_stock); continue; } ?> <h3 class="page-header"> Riston </h3> <?php if($row['social'] == 2){ echo showGoods($row['id'], $row['name'], $row['price'], $row['quanity'], $row['stock'], $is_stock); continue; } ?> <h3 class="page-header"> Labby </h3> <?php if($row['social'] == 3){ echo showGoods($row['id'], $row['name'], $row['price'], $row['quanity'], $row['stock'], $is_stock); continue; } ?> <?php endwhile; ?> But the problem arose : HTML also gets into while (), so on the output we have, for example, with two entries:
Category No. 1 [Record from DB] Category No. 2 [Record from DB] Category No. 3 Category No. 1 Category No. 2 Category No. 3
Those. HTML is also included in the loop, and this is not necessary. In fact, the task is childish, but I cannot figure out how to do something. With foreach, too, does not come out.
Actually, the question itself: how to display data from the database so that certain data is in a certain place in HTML, given that there is more data than 1 record?