I have a total of 42 records in the table. The problem is my one of my column, which indicates the Type of Leave, is call $empType. In my column of that table, the 24th record of $empType is called "Medical Leave" But because of the while loop, the $empType only shows the 42th record, therefore the whole if statement does not work.
I do not want it to show just 24th record, cause I know odbc_fetch_row will work as well, but I want it to loop all the way and capture all the data from each row.
$conn=odbc_connect("employee","","") or die (odbc_errormsg());
$sql1="SELECT * FROM employee WHERE Status='Pending'";
$rs1=odbc_exec($conn,$sql1);
while (odbc_fetch_row($rs1))
{
$leaveID=odbc_result($rs1,"Leave ID");
$empID=odbc_result($rs1,"empID");
$empType=odbc_result($rs1,"TypeOfLeave");
}
if ($status == "Approved" && $empType == "Medical Leave")
{
my code
}
echo $empType;
Can anyone help me get through this? I seriously need to get this done.
I'm using Microsoft access database ODBC.