0

I want to echo "the select statent to output the total working hours"

<?php
error_reporting(0);
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ms", $con);

$id = $_REQUEST['id'];
$result = mysql_query("SELECT id
                      , SEC_TO_TIME(SUM(TIME_TO_SEC(out_time)
                        -TIME_TO_SEC(in_time))) AS working_hours
                          FROM timetable
                        GROUP
                         BY id;");



echo "<center><table cellspacing='6'>
<tr>
<th><h4> Date </h2></th>
<th><h4> Time In </h2></th>
<th><h4> Time Out </h2></th>


</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td '> " . $row['SEC_TO_TIME(SUM(TIME_TO_SEC(out_time)
                        -TIME_TO_SEC(in_time)))AS working_hours'] ." </td>";
  echo "</tr>";
  }
echo "</table></center>";

mysql_close($con);
?>
<html>
<body>
<form action="total.php">
    <input name="total" type="submit" value="Total Hours">
</form>

</body>
</html>
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by LastMitch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.