This topic is locked

SUmming total hours in an event

6/23/2008 8:50:29 AM
PHPRunner General questions
S
swanside author

I use the below code that you helped me out with, it works great, but we need to change the output display.
If there are three inputs for the Working_Hrs I get the display to be like this.
Working Hrs

15.00

15.00

15.00
WHat I really need is to sum it all up so it shows me

Working Hrs


45.00
Thanks for your help.

Paul.

global $conn;

$sql = "select Working_Hrs from labour where job_no='".postvalue("editid1")."'";

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

if(!$data)

return;

echo "<table>";

while(1)

{

echo "<tr>";

foreach($data as $v)

{

echo "<td>";

echo htmlspecialchars($v);

echo "</td>";

}

echo "</tr>";

if(!($data = db_fetch_array($rs)))

break;

}

echo "</table>";

S
swanside author 6/23/2008

Its OK.
I changed my code.
Thanks

Paul