> I use the following to store the current date in my db: > > $date = date("mdY"); > > then to decrease the day by -1 I use the following: > > $date = date("Y"); > $date2 = date("m"); > $date3 = date("d")-1; > > $dateb = '$date$date2$date3'; > > Now what I need to do, is when a DB operation is run it checks the DB to > see > if there are any dates that match $dateb or less (Yesterday or before) and > then delete those only, leaving todays in the DB, I tried the following > with > no success: > > mysql_query ("DELETE FROM orderstemp WHERE < '$dateb' > "); > > This query works if I do a delete by id, but not how i'm doing it here, > does > anyone have any ideas? Be gentle with me, dates are newish to me :-) Well, in that case, I recommend you get in the habit of storing your dates in either the native format of your database or in a unix timestamp format. You will save yourself tons of work by doing it the right way. The say that you have it now, you'll have to explode that date string apart into each of it's components, day, month, year, and compare all of them. Probably easier to do it all in PHP if you're going to do it this way. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php