If you find the php date time functions not to your liking you will finder more easy to understand version in mysql.
all the best
Ryan A wrote:
Hi, Thanks for replying.
Am a bit confused even after your example as to how to enter this into the datetime field in mysql so that i can compare it to the present datetime
heres the code i made based on what you said: <?php $day=2; $hour=2; $seconds=05;
$theDay=24*60*60; $theHour=60*60; //$theSec=$seconds;
$FinalDay=$day*$theDay; $FinalHour=$hour*theHour;
$offset=$FinalDay + $FinalHour + $seconds; $FinalTime=time() + $offset;
print time(); echo "<br><br>"; print $FinalTime; echo "<br><br>"; $Result=mktime($FinalTime); echo $Result;//gives a warning or error ?>
Its giving me a number based on the above that is correctly higher than time() but how do i enter that into mysql for a comparision?
eg: my table structure in mysql is so: present_day datetime expire_day datetime filename varchar(50)
(my logic) if ($present_day - $expire_day <= 0) {echo "link expired";} //else //give file
Kindly reply, -Ryan
-- http://www.raditha.com/php/progress.php A progress bar for PHP file uploads.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php