# Simple list filter

**URL:** <https://forum.kirupa.com/t/simple-list-filter/312185>\
**Category:** Uncategorized\
**Created:** [July 27, 2010, 5:53pm UTC](https://forum.kirupa.com/t/simple-list-filter/312185 "2010-07-27T17:53:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jacob](https://forum.kirupa.com/u/jacob)\
**Post date:** [July 27, 2010, 5:53pm UTC](https://forum.kirupa.com/t/simple-list-filter/312185/1 "2010-07-27T17:53:31Z")

</div>

I’ve been searching for an answer to this, but haven’t found one that fits.

I have a php file which produces a list of jobs and data on each job, including status. I’d like to add a filter above the list to show/hide based on status.  
I know this could be done with a custom query to the mySQL DB, but could also be done with Javascript or AJAX.  
Can someone point me to a tutorial or a solution to this?

here is the code in question:

```auto

$query = "SELECT * FROM jobs_table ";
$result = mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();

if ($num > 0 ) {
$i=0;
while ($i < $num) {
$job_number = mysql_result($result,$i,"job_number");
$client_name = mysql_result($result,$i,"client_name");
$job_name = mysql_result($result,$i,"job_name");
$billable = mysql_result($result,$i,"billable");
$comments = mysql_result($result,$i,"comments");
$status = mysql_result($result,$i,"status");
$id = mysql_result($result,$i,"id");

echo "$job_number $client_name $job_name $status";
echo "<br>";

++$i; } } else { echo "The database is empty"; }?>

```
