I have two tables...
project table
+----+--------+
| id | client |
+----+--------+
| 1 | James |
| 2 | John |
+----+--------+
images table
+----+-----------+-------------------+
| id | projectId | imagePath |
+----+-----------+-------------------+
| 1 | 1 | images/image1.jpg |
| 2 | 1 | images/image2.jpg |
| 3 | 2 | images/image3.jpg |
| 4 | 2 | images/image4.jpg |
| 5 | 2 | images/image5.jpg |
+----+-----------+-------------------+
As you can see, one project has many images. I want to display that this way...
James
images/img1.jpg
images/img2.jpg
John
images/img3.jpg
images/img4.jpg
images/img5.jpg
This post gave me what I want https://stackoverflow.com/a/2451065/1214535
But when I echo like so
<img src='".$row['imagePath']."/>
the results in image tag I get this
<img src="images/img3.jpg,images/img4.jpg,images/img5.jpg">
instead of
<img src="images/img3.jpg"/>
<img src="images/img4.jpg"/>
<img src="images/img5.jpg"/>
How can I change the query so that I can display the images properly/separately
this is the query I am using
$sql="SELECT images.projectId,project.client,
GROUP_CONCAT(images.imagePath SEPARATOR ', ')
AS 'imagePath'
from project left JOIN images on project.id=images.projectId
GROUP BY project.id ASC";
thank you guys...