I have this PHP Code:
$sql="SELECT ticket_seq, SUM(TIMEDIFF(timeend, timestart)) as total FROM ticket_updates GROUP BY ticket_seq";
$rs=mysql_query($sql,$conn) or die(mysql_error());
if(mysql_num_rows($rs) > 0)
{
while($result=mysql_fetch_array($rs))
{
$sql2="SELECT * from tickets where ticketnumber = '".$result["ticket_seq"]."' ";
$rs2=mysql_query($sql2,$conn) or die(mysql_error());
$result2=mysql_fetch_array($rs2);
$sql3="SELECT * from customer where sequence = '".$result2["company"]."' ";
$rs3=mysql_query($sql3,$conn) or die(mysql_error());
$result3=mysql_fetch_array($rs3);
if($result["total"] > $result3["support_hours"])
{
echo $result3["company"].' - '.$result["total"].'<br>';
}
}
}
but then when i echo $result["total"] i just get random numbers.
I am trying to select the time difference between timestart and timeend for multiple rows and add it together.