Re: problem with mktime
| From: | Richard Lynch | Date: | Mon, 01 May 2006 01:27:29 +0000 |
| Subject: | Re: problem with mktime | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235176@lists.php.net to get a copy of this message | ||
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