Re: finding news stories in a selection of months

From: Date: Wed, 04 Feb 2004 15:32:58 +0000
Subject: Re: finding news stories in a selection of months
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176799@lists.php.net to get a copy of this message
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 dread@texas.net -- 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.

« previous php.general (#176799) next »