Display category and image in ul li
<p>I want to display category and category image. There are n number of categories</p>

<pre><code> &lt;?php

    $sg = "select * from tbl_gal order by gal_name";
    $sq = Query($sg) or die(mysql_error());
    while($sd = FetchArray($sq))
    {


    ?&gt;
    &lt;h3&gt;&lt;?php if($_SESSION['lang']=='ru') { echo GetCategoryRuss($sd['gal_name']);} else { echo GetCategoryEng($sd['gal_name']); } ?&gt;&lt;/h3&gt;
        &lt;ul class="category"&gt;

        &lt;li&gt;
                &lt;a href="photos/&lt;?php echo $sd['image_name'] ?&gt;" title=""&gt;
            &lt;img src="&lt;?php echo GetSiteRoot();?&gt;photos/&lt;?php echo $sd['image_name'] ?&gt;" alt="&lt;?php echo $sd['details'] ?&gt;" width="100px" height="100px" /&gt;
                                 &lt;/a&gt;
            &lt;/li&gt;

&lt;/ul&gt;

&lt;?php } ?&gt;
</code></pre>

<p>I want to diplay</p>

<pre><code>&lt;h3&gt;Category 1&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;cat 1 image1&lt;li&gt;
 &lt;li&gt;cat 1 image2&lt;li&gt;
&lt;/ul&gt;

  &lt;h3&gt;Category 2&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;cat 2 image1&lt;li&gt;
 &lt;li&gt;cat 2 image2&lt;li&gt;
&lt;/ul&gt;
</code></pre>

<p>But It display</p>

<pre><code> &lt;h3&gt;Category 1&lt;/h3&gt;
  &lt;ul&gt;
  &lt;li&gt;cat 1 image1&lt;li&gt;
  &lt;/ul&gt;

  &lt;h3&gt;Category 2&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;cat 2 image1&lt;li&gt;
&lt;/ul&gt;

&lt;h3&gt;Category 1&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;cat 1 image1&lt;li&gt;
&lt;/ul&gt;
</code></pre>

<p>Here is table Structure</p>

<pre><code>tbl_category

category_id   |   category_name
1             |    Test
2             |    Abc
tbl_gall

category_id   | image_name
1             | image1.jpg
2             | image2.jpg
1             | image3.jpg
</code></pre>

<p>I am not really sure how to do it.</p>

<p>I will appreciate any inputs or help.</p>

<p>Thanks in advance.</p>
