RE: [PHP] Is this the most effient to do with php an mysql?

From: Date: Tue, 07 Feb 2006 04:32:18 +0000
Subject: RE: [PHP] Is this the most effient to do with php an mysql?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230028@lists.php.net to get a copy of this message
And mysql is probably the fastest way. BUT use microtime and clock your scripts to find out witch one is faster. -----Original Message----- From: Paul Goepfert [mailto:paul.goepfert@gmail.com] Sent: Tuesday, February 07, 2006 10:45 AM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Is this the most effient to do with php an mysql? I am using this table to find out what year the person purchased their equipment On 2/6/06, Peter Lauri <peter@lauri.se> wrote: > I do not know if it is more efficient, but you can do this: > > $year = date("Y"); > $Query = sprintf("SELECT y_id, year FROM Year WHERE year <= %s ORDER BY year > DESC;", $year); > $Result = mysql_query($Query); > > May I ask you what you are using this table for? > > /Peter > > -----Original Message----- > From: Paul Goepfert [mailto:paul.goepfert@gmail.com] > Sent: Tuesday, February 07, 2006 7:55 AM > To: php-general@lists.php.net > Subject: [PHP] Is this the most effient to do with php an mysql? > > Hi all, > > I have a table of years going from 1985 - 2008. These years represent > the purchase year. I have created a SQL statement that selects the > years that are available for purchase years. For example 2006 -1985. > Here is the SQL statement I created to produce that output. > > > SELECT y_id, year FROM Year WHERE year <= extract(year from now()) > ORDER BY year desc; > > Is there a more efficient way to do this using more PHP and less mysql? > > Thanks > > Paul > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#230028) next »