Re: problem with mktime

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

 



On Sun, April 30, 2006 6:38 am, Ross wrote:
> 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";

Instead of fighting with mktime and using PHP logic to discard data
you pull through the narrow pipe from MySQL to PHP, why not just
construct your query to return what you want?

SELECT substring(headline, 1, 80), length(substring(headline, 80, 1))
as ellipsis, id, link FROM events where expiry >= now()";

You can use $row['ellipsis'] to decide to print "..." or not for the
headline itself.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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