On 02-Feb-2004 Michael Hill wrote:

> Hi everyone,
<snip>
> heres the code i have:
>  
>  $strSQL = "SELECT date from ".$tbl_prefix."news  where live=1 order
> by
> date asc limit 0,1";
>  $result = mysql_query($strSQL,$dbconn);
>  $firstresult = mysql_fetch_array($result);
>  $firstdate = $firstresult['date'];
>  $firstmonth = substr($firstdate, 4, 6);
>  $firstyear = substr($firstdate, 0, 4);
>  
>  
>  
>  
>  $strSQL = "SELECT date from ".$tbl_prefix."news  where live=1 order
> by
> date desc limit 0,1";

<snip>

$qry="SELECT MIN(date) AS first, MAX(date) as last FROM ...";
$res=mysql_query($qry);

if (mysql_numrows($res) ) {
   $row=mysql_fetch_array($res);
   list($fy, $fm, $fd) = explode('-', $row['first']);
   list($ly, $lm, $ld) = explode('-', $row['last']);
} else {
   echo 'Not found', '<P>';
}

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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

Reply via email to