# Query inside Li (list)

**URL:** <https://forum.kirupa.com/t/query-inside-li-list/307378>\
**Category:** programming\
**Created:** [April 2, 2010, 10:06am UTC](https://forum.kirupa.com/t/query-inside-li-list/307378 "2010-04-02T10:06:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LittleMore](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@LittleMore](https://forum.kirupa.com/u/LittleMore)\
**Post date:** [April 2, 2010, 10:06am UTC](https://forum.kirupa.com/t/query-inside-li-list/307378/1 "2010-04-02T10:06:09Z")

</div>

I have a db table “table” as follows:

CatID ParentID Name Choice  
1 0 first 1  
2 0 second 2  
3 0 third 2  
4 1 fourth 1  
5 4 fifth 2  
6 1 sixth 2

and I have List as follows:

echo ‘\<li\>’ . $value[‘name’] . ;  
echo’\<a href="gofast.php?new=forecast&newCatId=’ . $value[‘CatID’] .\<img src=“images/green.gif” ‘\</a\>’;  
\<a href="goslow.php?new=warning&CatId=’ . $value[‘CatID’] .\<img src=“images/red.gif” ‘\</a\>’;  
echo ‘\</li\>’;

I need to display “green.gif” only when the row has choice=1.  
In other words when the choice = 1, both “green.gif and red.gif” are displayed.  
Similarly, when choice=0 only “red.gif” should be displayed.  
I can get the mysql $query/$result but unable to achieve my requirement as stated above. Any suggestions please?

Thank you in advance.
