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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.