Jump to content

Trouble with remaining time display.


Greaser9780

Recommended Posts

At this point I don't even know what type to set my field to in my table.

I have a table where I keep a value"expirytime".

I have tried TIME,DATETIME,TIMESTAMP and get nothing but an undesireable result. Here is my code for the script that displays time remaining in minutes and seconds:

<?php

include("db.php");

$blah=mysql_query("SELECT exptime FROM time ");

$rst=mysql_fetch_array($blah);

$n= time();

$t=$rst["exptime"];

$disp=$t - $n;

echo $t ;

echo"<br>";

echo $n;

echo"<br>";

$minutes = floor($disp /3600);

echo date("i:s",$minutes) ;

include("login.php");

 

?>

I think the main problem is I can't seem to get $n and $t to be displayed in the same format. I banged my head against the wall for hours last night. Any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/40071-trouble-with-remaining-time-display/
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.