Re: php/mySql SELECT where clause using dates.

From: Date: Thu, 03 May 2001 09:57:35 +0000
Subject: Re: php/mySql SELECT where clause using dates.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51281@lists.php.net to get a copy of this message
Hello, maybe this could help, WHERE TO_DAYS( NOW()) - TO_DAYS( your_date_field ) <= 45 py At 04:30 PM 5/3/01 +0200, you wrote:
***NEWBIE ALERT*** (I am only very new at this) PHP and MySQL OK - I have a table with data and one of the fields is a Date field. Now I would like to SELECT all records where the date is less that 45 days old. Eh, How do I do that? I have tried this: #Declaring variables $today=date("Y-m-d"); $lastmonth = $today-30 $query = "SELECT * FROM customers WHERE Site='egebjergnet' AND DatoOprettet>'$lastmonth' ORDER BY FirmaNavn"; AND I get an error, of course. hmmm -- ================================== Regards from Denmark, Europe Please cc your reply to dan@eskildsen.net ================================== I haven't lost my mind, I've got it backed up on TAPE somewhere....... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
+ ====================== + Pierre-Yves Lem@ire + E-MedHosting.com + (514) 729-8100 + pylem@sympatico.ca + ======================

« previous php.general (#51281) next »