Jump to content

Counting hours from mysql-table


dwesdijk

Recommended Posts

Hi all,

 

I'm working on a page which displays some computers to repair. Each repair has a sub page where employees can add a comment. All comments are saved in the mysql-table with a time. That displays the time how long the employee was busy with the repair. In that subpage it has to display a sum of all the hours.

 

This is the query to count the hours:

419 $query = "SELECT sum(hourcount) FROM ds_comment WHERE recall_id = $recall_id";
420 $hourtotal = $mysqli->query($query);

 

This is where it has to be shown:

463 echo "      <td class='table_cel_2'>".$hourtotal."&nbsp</td>";

 

This is the error i get:

Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\installatieruimte\index.php on line 463

 

Tabel:

id recall_id   comment date     time         hourcount employee

55 38           23         39747    16:15:18        00:30:00 Martin van der Meer

53 38           Test     39747    16:04:09     00:20:00 David Wesdijk

54 38           Test2      39747    16:04:38   02:40:00 David Wesdijk

 

What does it have to do:

Make a sum of the 'hourcount' with the same 'recall_id'

 

Could you help me out?

 

Thanks in advance,

 

David Wesdijk

The Netherlands

Link to comment
https://forums.phpfreaks.com/topic/130290-counting-hours-from-mysql-table/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.