Re: Sorting db entries by Year-Month

From: Date: Wed, 24 Jul 2002 00:47:35 +0000
Subject: Re: Sorting db entries by Year-Month
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109177@lists.php.net to get a copy of this message
What do you guys think? Should we tell him he's running a vulnerable version of PHP _and_ of Apache??? On Tuesday 23 July 2002 16:26 pm, Andre Dubuc wrote: > Apache 1.3.23 + PHP 4.1.2 + PostgreSQl 7.2 > > I have a guestbook that I would like to display the current month's > entries. I can display all the entries before the current month, but i > can't seem to figure out how to extract the currrent month's. > > Although the code below is a db issue, I don't know whether I should write > code to extract the info before or after the db connection. Should I: > > 1. Set up the parameters beforehand in PHP, and then do a query; > 2. Within the query itself (as the code I tried [and didn't work] below); > 3. Or, somehow in PHP, after I get all the results [obviously without the > db WHERE clause]. > > <?php > // lots of code > > $db = pg_connect("dbname=rap user=postgres"); > $query = "SELECT * FROM guest WHERE pdate = "{$_SESSION['pdate'] == > date('Y-m')"; // pdate is formatted ('Y-m-d') > > // etc, etc. . . > ?> > > I know this is a simple question -- but my mind's totally blotto after a > day's coding. > > Any help, pointers of where to look, or admonitions will be gratefully > accepted. > > Tia, > Andre -- If you pick up a starving dog and make him prosperous, he will not bite you; that is the principal difference between a dog and a man. Samuel Clemens

« previous php.general (#109177) next »