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:
$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"; }?>