Re: php/mySql SELECT where clause using dates. ooops

From: Date: Thu, 03 May 2001 14:40:36 +0000
Subject: Re: php/mySql SELECT where clause using dates. ooops
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-51280@lists.php.net to get a copy of this message
i'm sorry, I looked at the wrong part. You need to use the PHP functions to convert your date to a timestamp, then subtract 30 days from it, then reconvert to a MySQL date format. Jon ----- Original Message ----- From: "Jon Rosenberg" <php@columbusinteractive.com> To: "Dan Eskildsen" <dan@eskildsen.net> Cc: "PHP General List" <php-general@lists.php.net> Sent: Thursday, May 03, 2001 10:28 AM Subject: Re: [PHP] php/mySql SELECT where clause using dates. > Take out the order by clause or chaqnge it. You can't order by a column you > aren't selecting. > > > ----- Original Message ----- > From: "Dan Eskildsen" <dan@eskildsen.net> > To: <php-general@lists.php.net> > Sent: Thursday, May 03, 2001 10:30 AM > Subject: [PHP] php/mySql SELECT where clause using dates. > > > > ***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 > > > > > -- > 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 > >

« previous php.general (#51280) next »