title: mysql join one to many with images
body: <p>I have two tables...</p>
  
  <p><strong>project table</strong> </p>
  
  <pre><code>+----+--------+
  | id | client |
  +----+--------+
  |  1 | James  |
  |  2 | John   |
  +----+--------+   
  </code></pre>
  
  <p><strong>images table</strong></p>
  
  <pre><code>+----+-----------+-------------------+
  | 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 |
  +----+-----------+-------------------+
  </code></pre>
  
  <p>As you can see, one project has many images. I want to display that 
  this way...</p>
  
  <pre><code>James
  
  images/img1.jpg
  images/img2.jpg
  
  John
  
  images/img3.jpg
  images/img4.jpg
  images/img5.jpg
  </code></pre>
  
  <p>This post gave me what I want       <a href="https://stackoverflow.com/a/2451065/1214535">https://stackoverflow.com/a/2451065/1214535</a></p>
  
  <p>But when I echo like so</p>
  
  <pre><code>&lt;img src='".$row['imagePath']."/&gt;
  </code></pre>
  
  <p>the results in image tag I get this</p>
  
  <pre><code>&lt;img src="images/img3.jpg,images/img4.jpg,images/img5.jpg"&gt;
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>&lt;img src="images/img3.jpg"/&gt; 
  &lt;img src="images/img4.jpg"/&gt;
  &lt;img src="images/img5.jpg"/&gt;
  </code></pre>
  
  <p>How can I change the query so that I can display the images properly/separately</p>
  
  <p>this is the query I am using</p>
  
  <pre><code>$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";
  </code></pre>
  
  <p>thank you guys...</p>