forumnz Posted September 23, 2007 Share Posted September 23, 2007 Hi I got this iff Barand - thanks. I just can't get it to work. Am I doing something wrong? <?php //Connect to mysql server $link=mysql_connect("localhost","AAA","AAA"); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db=mysql_select_db("bbmembers"); if(!$db) { die("Unable to select database"); } $qry="SELECT * FROM auctions WHERE uan=2"; $end = strtotime ($db_enddate); // enddate from the db record for the item $seconds_left = $end - time(); $days_left = floor($seconds_left / 86400); $seconds_left = $seconds_left % 86400; $hours_left = floor($seconds_left / 3600); $seconds_left = $seconds_left % 3600; $mins_left = floor($seconds_left / 60); $seconds_left = $seconds_left % 60; echo "$days_left days $hours_left hours $mins_left minutes $seconds_left seconds left"; ?> The output is : -13780 days -20 hours -57 minutes -50 seconds left Thanks, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/70372-solved-display-time-left/ Share on other sites More sharing options...
BlueSkyIS Posted September 23, 2007 Share Posted September 23, 2007 you aren't running mysql_query() anywhere, so you have no results. Quote Link to comment https://forums.phpfreaks.com/topic/70372-solved-display-time-left/#findComment-353538 Share on other sites More sharing options...
darkfreaks Posted September 23, 2007 Share Posted September 23, 2007 yeah you have to query the DB time fields for it to echo anything Quote Link to comment https://forums.phpfreaks.com/topic/70372-solved-display-time-left/#findComment-353540 Share on other sites More sharing options...
forumnz Posted September 23, 2007 Author Share Posted September 23, 2007 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/70372-solved-display-time-left/#findComment-353545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.