multiple values from joined tables
<p>I have this situation where i want to get data from 3 different databases, say <code>events</code>, <code>content</code> and <code>media</code> and the look like this:</p>

<pre>
events

-------------------------
| e_id  | e_title       |
-------------------------
| 1 | event 1   |
| 2 | event 2   |
| 3 | event 3   |
-------------------------

content

-------------------------
| c_id  | c_title       |
-------------------------
| 1 | first event   |
| 2 | second event  |
| 3 | third event   |
-------------------------

media

-------------------------
| m_id  | m_title       |
-------------------------
| 1 | picture 1 |
| 1 | picture 2 |
| 1 | picture 3 |
-------------------------
</pre>

<p>Now i want to get the information from event 1, with the <em>three</em> pictures, so i have the following query</p>

<p><pre><code>
$result = mysql_query("
SELECT  events.e_id, events.e_title, content.c_id, content.c_title, media.m_id, media.m_content
FROM events 
INNER JOIN content 
ON events.e_id = content.c_id
INNER JOIN media 
ON events.e_id = media.m_id
WHERE events.e_id = '1'");
</pre><code></p>

<p>Now the point is, when i use </p>

<pre><code>$show = mysql_fetch_assoc($result); 
echo($show['e_title']." - ".$show['m_title'])</code></pre>

<p>I only get picture 1</p>

<p>when i use </p>

<pre><code>while($show = mysql_fetch_assoc($result)){ 
echo($show['e_title']." - ".$show['m_title']);}</code></pre>

<p>i get three times event 1</p>

<p>How can i combine this that my output will be something like:</p>

<pre>
event 1
 * picture 1
 * picture 2
 * picture 3
</pre>

<p>?</p>

<p><b>EDIT:</b></p>

<p>The solution below works fine, but now i have the following that doesn't work</p>

<p><pre>
while($show = mysql_fetch_assoc($result)){
    if($show['e_title'] !== $last_title){
        echo("&lt;h3>".$show['e_title']."&lt;/h3>\n&lt;ul>\n");
    }
    echo("\t&lt;li>".$show['m_title']."&lt;/li>\n");
    if($show['e_title'] !== $last_title){
        echo("\t&lt;/ul>\n");
    }
    $last_title = $show['e_title'];
}
</pre></code></p>

<p>How can i achieve that my output will be like:</p>

<p><pre>
Event 1
 * picture 1
 * picture 2
 * picture 3</p>

<p>More info about event 1 (not shown in example)</pre></code></p>

<p>?</p>
