Jump to content

[SOLVED] Display time left


forumnz

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/70372-solved-display-time-left/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.