A table in my database has a field named table_id.
For each "real" table (not mysql table) a certain amount of work is being done.
The time it takes for verious tasks at the tables to be compleated is being tracked in a field called time.
I can extract the times from each table to a page but I still need to add the total time for all tasks at each "real" table.
Example DB:
table_id time
1 57283
1 6954
2 6882495
2 985146
3 822469658
3 5867
Example Page Output:
Total Table Time
57283
6954
What I Need:
Total Table Time
Table 1 64237 17.84 hours
Table 2 7867641 2185.46 hours
Table 3 822475525 228465.42 hours
Here is what I have so far(I threw an actual table id in there for simplicity during testing): Any Ideas?
<?php
include('user_check.php');
include('db_con.php');
?>
<html>
<head>
<title>Reports</title>
</head>
<body bgcolor="white">
<font face="Verdana, Arial, Helvetica, sans-serif">
<?php
$query="SELECT time FROM job_log WHERE table_id=100391";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Total Table Time</center></b><br><br>";
$i=0;
while ($i < $num)
{$time=mysql_result($result,$i,"time"); echo "<center>$time<br></center>"; $i++;}
?>
</body>
</html>