i have two tables "apartment" and rooms

Apartment Table:

id Apartment
1 abc

Room Table:

id apartment_id room_name
1 1 abc1
2 1 abc2
2 1 abc2

now I want to display 1 row in PHP but in a single column, I want to display all rooms...

<td class="align-middle">
foreach($data->getData("SELECT * FROM rooms WHERE apartment_id = '".$row['id']."' ORDER BY id DESC") as $rooms){
<p class="mb-1 font-weight-500"><?php echo $rooms['title'] ?></p>

i want to remove the select query in the

  • SELECT r.id, r.room_name, a.Apartment FROM rooms r JOIN Appartment_table a ON r.apartment_id=a.id. Apologizes if I truncated your question. – danblack Apr 13 at 10:38
  • I don't see the column title. – Rick James Apr 13 at 18:07

Browse other questions tagged or ask your own question.