problem with mktime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using this to compare todays date with dates retieved from a database. 
The problem is it seem to retrun the same value for the $then variable

and can be seen ot working here....

http://nationalservicesscotland.com/cms/time.php


<?

session_start();
include ('../shared/connect.php');

$query= "SELECT headline, id, expiry, link FROM events";

 $result= mysql_query($query);


   while  ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){


$compare= explode("/", $row['expiry']);


$day = isset($compare[0]) ? $compare[0] : null;
echo "day is $day<br>br><br>";
$month = isset($compare[1]) ? $compare[1] : null;
echo "month is $month<br>br><br>";
$year = isset($compare[2]) ? $compare[2] : null;
echo "year is $year<br>br><br>";

$then = mktime(0,0,0,$month,$day, $year);

$now = mktime (0,0,0,date("m"),date("d"),date("Y"));


$diff = $now - $then;

echo "today is $today<BR>";
echo "expiry date is $ross<br>";
echo "now mktime value is is $now<br>";
echo "then mkvalue is $then<br><br>";
if ($diff < 0 ) {
/*$text = stripslashes ($row['headline']);
  $newtext = wordwrap($text, 12, "\n", 1);
  $link=$row['link'];
  echo $newtext."<a href=\"$link\">...read more</a>"."<br /><br />";*/

 }
 }
?> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux