Re: Re: problem with mktime
| From: | chris smith | Date: | Sun, 30 Apr 2006 13:23:02 +0000 |
| Subject: | Re: Re: problem with mktime | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235145@lists.php.net to get a copy of this message | ||
On 4/30/06, Ross <ross@aztechost.com> wrote:
soted it ! Thanks.please enlighten us in case someone else has the same sort of issue...
""Ross"" <ross@aztechost.com> wrote in message news:AA.28.18514.C82A4544@pb1.pair.com... 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-- Postgresql & php tutorials http://www.designmagick.com/