0

<select name="criteria" class="report_listbox">
<option value="">Status</option>
<option value="PASS">PASS</option>
<option value="FAIL">FAIL</option>
<option value="ALL">ALL</option>
</select>
------------------------------------------------------------------------------------
$date = $_POST;
$criteria = $_POST;

$sql=" SELECT frsemployees.`name`, bft.`date`,bft.`dpush`,bft.`push`,
bft.`dsit`,bft.`sit`,bft.`drun`,bft.`run`,bft.`status`
FROM `bft`
INNER JOIN frsemployees ON frsemployees .empid = bft.empid
WHERE bft.`date`= '".$date."' AND bft.`status` = '".$criteria."' ";
--------------------------------------------------------------------------------------
the bft database table `status` row containes "FAIL" or "PASS". now when i select "PASS" and "FAIL im getting all the people who passes and failed... how can i modifie the query so that when i click "ALL" in the dropdown list box and get all "PASS" and "FAIL"

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by karthik_ppts
0

Just leave off the criteria bit from the where clause

Then i wont get "PASS" and "FAIL" employees... the criteria includes "PASS" "FAIL" and "ALL"

1
$date = $_POST['date'];
$criteria = $_POST['criteria'];
$join="";
if($criteria=="PASS" || $criteria=="FAIL" )
{
$join=" AND bft.`status` = '".$criteria."'";
}
$sql=" SELECT frsemployees.`name`, bft.`date`,bft.`dpush`,bft.`push`,
bft.`dsit`,bft.`sit`,bft.`drun`,bft.`run`,bft.`status`
FROM `bft`
INNER JOIN frsemployees ON frsemployees .empid = bft.empid
WHERE bft.`date`= '".$date." $join";
0

AS KP puts it, you just leave off the status part when ALL is the criteria.

Thank you both of you.. it really helped me...thanks again

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.