Not able to get total of all the rows in the result mysql + php

I want to display the total of all rows which are displayed for each employee

the below code is to display hours spent by each employee in some workshop

php $sqluser=“SELECT eName FROM emp ORDER BY eName”;
$sqluser;
$res=mysql_query($sqluser);
while($rw=mysql_fetch_array($res))
{

$name=$rw[‘eName’];
?>

<?php echo $name; ?> <?php $sqlType="select wId from wm WHERE `wType` = 'IND' "; $resType=mysql_query($sqlType); while ($rType=mysql_fetch_array($resType)) { $diff $id=$rType['wId']; $sqlindhrs="select eHours from wp where eName='$name' and wId='$id'"; $resindhrs=mysql_query($sqlindhrs); while($recindhrs=mysql_fetch_array($resindhrs)) { $indhrs=$recindhrs['eHours']; ?> <?php echo $indhrs; ?> <?php }
 }

}

?>

In this case I am getting hours for each employee seperated, but I want the total hrs by for employee.

Please help

Run that second query, just use SUM(ehours)

Sponsor our Newsletter | Privacy Policy | Terms of Service