For some reason, dates and databases seem to cause problems for many people. Yes, you should certainly rtfm, there are many functions in php and mysql/postgresql that deal with functions and they may clarify your problem. Then again, they may not.
The basic problem that most people run into is that they attempt to compare dates that are in different formats. Just because your database dates and php date are both integers does not mean they are in the same format. One could easily be formatted MMDDYYYY while the other is formatted YYDDMM. Obviously you will not get the desired results if you attempt to compare dates in different formats. My first suggestion would be to use the date data type instead of an integer. There are all kinds of built in funtions for dealing with dates in the date format. If you must use integers for some reason use the unix time stamp because there are also functions for dealing with that date/time format. If you have no control over the way data is stored in the database, take a good look at the actual data and make sure that your php date is formatted exactly like your database dates. If you are going to stick with integer dates then you do not use the quotes around the variable, as they are used for strings and not numbers. Fred Brian Grayless <[EMAIL PROTECTED]> wrote in message C3C8C2499A63D211BB7D00A0C9E1C7060128707F@PRI-NT1">news:C3C8C2499A63D211BB7D00A0C9E1C7060128707F@PRI-NT1... > I'm trying to delete rows from a database where the date is older then my > $expDate variable, but for some reason, no matter what I try and what > examples I use for help, I can't get this to work??? I first took the > $expDate string and set the var type to "integer". The datatype for the > "msgCreated" field is "int". > > I first tried: > $sql = "DELETE * FROM Table WHERE msgCreated < '$expDate'"; > > and it didn't work so I then tried it without the single quotes: > > $sql = "DELETE * FROM Table WHERE msgCreated < $expDate"; > > still, it didn't work. Am I missing something fundamental here? Is this one > of those RTFM questions? > > Thanks, > > Brian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]