Hello, developers!
Faced such a problem:
Now displayed in this way (1 - category, 2 - article)
1) Nature 2) In the animal world
1) Nature 2) Plants
And you need to display it like this:
1) Nature 2) In the animal world 2) plants
I have a MySQL database with such data
2 tables: caregories table (has columns: id, title), goods table (has columns: id, name, category)
Here is the code I bring
<?php $connect = mysqli_connect('localhost', 'olegmowk_1', '1425pmrmsw', 'olegmowk_1'); if ($connect == false) { echo "Error connect"; } $result = mysqli_query($connect, " SELECT categories.title, goods.name FROM categories INNER JOIN goods ON categories.id = goods.category ORDER BY categories.id; "); while ( ($cat = mysqli_fetch_assoc($result)) ) { echo $cat['title']; echo " = "; echo $cat['name']; } ?> I hope everything is clear explained