Vidya_tr Posted April 30, 2009 Share Posted April 30, 2009 SELECT timediff('2009-04-30 14:40:00',sysdate()); this when done using mysql console returns the difference in time. But how can I get the result of this query in a php variable?? Please help... Link to comment https://forums.phpfreaks.com/topic/156237-solved-getting-the-difference-between-a-time-and-system-time/ Share on other sites More sharing options...
ignace Posted April 30, 2009 Share Posted April 30, 2009 <?php $query = "SELECT timediff('2009-04-30 14:40:00',sysdate()) as timedifference"; $queryResult = mysql_query($query); list($timedifference) = mysql_fetch_array($queryResult, MYSQL_FETCH_NUM); ?> Link to comment https://forums.phpfreaks.com/topic/156237-solved-getting-the-difference-between-a-time-and-system-time/#findComment-822505 Share on other sites More sharing options...
Vidya_tr Posted April 30, 2009 Author Share Posted April 30, 2009 I had an array on the above code you posted:some error on the parameters of mysql_fetch_array: but got it like this.... <?php $query = "SELECT timediff('2009-04-30 14:40:00',sysdate()) as timedifference"; $queryResult = mysql_query($query); list($timedifference) = mysql_fetch_row($queryResult); ?> thanks..... Link to comment https://forums.phpfreaks.com/topic/156237-solved-getting-the-difference-between-a-time-and-system-time/#findComment-822515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.