Let say I wan to sum up the Duration in my leave table and with condition Leave_Type = 'Annual' and Status = 'Approved'
My database
table leave
{Leave_ID(PK), Leave_Type, Status, Duration, Emp_ID(FK)}
table employee
{Emp_ID(PK), Emp_Name}
I use the following code to sum the Duration
$aid=$_SESSION["eid"];
$Annual = mysql_query("select SUM(Duration)
FROM `leave`
WHERE leave.Leave_Type = 'Annual' and leave.Status = 'Approved'
and leave.Emp_ID = employee.Emp_ID and leave.Emp_ID = $aid");
The way i display the output
<td><?php echo $Annual;?></td>
But the output I get is something like "Resourse id#4". That's not the output I want and it should be the total sum of duration. Is there is any problem with mysql_query or the way i print my output?
typeof thedurationcolumn? Integer, Datetime?employee.Emp_IDbut doesn't reademployee. It's impossible that it returns any output: it must be crashing.