2
I’m wanting to list a table record and display the sum of reported hours, but I’m not getting it.
The Reports table has the Registration and Duration field
registration duration
2501 00:40:00(timestamp)
2501 01:20:00(timestamp)
5531 01:20:00(timestamp)
I want to list the sum of hours(Duration) for each record(Registration)
$hours = mysql_query("SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( duration ) ) ) AS duration_sum FROM reports");
$horas = mysql_result($hours,0,"duration_sum");
while($row=mysql_fetch_row($horas)){
<tr>
<td align="center"><div align="left"><? echo($row[1]); ?></div></a></td>
<td align="center"><div align="center"><? echo($row[2]); ?></div></td>
</tr>
}
Return an error? What is the output? What is your select returning?
– Giancarlo Abel Giulian
Warning: mysql_fetch_row() expects Parameter 1 to be Resource, string Given in /home/fabvirtual/public_html/portal/comgap-hours.php on line 127
– Alexandre Gomes
What is line 127?
– Giancarlo Abel Giulian
while($Row=mysql_fetch_row($hours)){
– Alexandre Gomes
And executing the command directly on the bank, the SELECT, which is the output?
– Giancarlo Abel Giulian