PHP and MySQL - login elapse time
I am trying to diaply my login elapse time but encounter some problem. Hope someone can help
Run in phpmyadmin
***********
SELECT sec_to_time( (
(
to_days( '2003-08-08 20:51:43' ) - to_days( '2003-08-08 20:51:39' ) ) * 86400
) + ( time_to_sec( '2003-08-08 20:51:43' ) - time_to_sec( '2003-08-08 20:51:39' ) )
) AS elapsetime
elapsetime = 00:00:04
My code (the sql variable is the select string above)
*******
$result = mysql_query($sql);
$totalelapsetime = $result[elapsetime];
echo $totalelapsetime;
I got nothing from the echo $totalelapsetime.
When I echo out the $sql, I got the above select stmt.
What did I do wrong?
|