I am trying to populate an HTML table with data coming from my database. Here I saved the βservicesβ in my table. Each service can have multiple images. Therefore, when filling out the table, it should have 3 cells tables, one for the "service name", and the second for the "description" and the third for the images.
This my SQL query looks like this:
$prep_stmt = " SELECT s.id , s.name , s.description , i.image , i.image_path FROM services s LEFT JOIN images i ON i.service_id = s.id";
This is what my while looks like:
while ($stmt->fetch()) { $html = "<tr>\n"; $html .= " <td><input type='checkbox'></td>\n"; $html .= " <td>\n"; $html .= " <a href='' class='name'>{$name}</a>\n"; $html .= " </td>\n"; $html .= " <td class='view_html'>{$description}</td>\n"; $html .= " <td>\n"; --- My images should be display here ---- $html .= " </td>\n"; $html .= "</tr>\n"; //Add output to array $output[] = $html; }
My problem is how to display multiple images in one table cell? If one service has only one image, I can do it, but I have several images, then I'm not sure how to do it.
source share