Jump to content

Recommended Posts

Posted

The problem I have is that I need to insert into a table where the date is greater than the latest date stored in database:

 

INSERT INTO backup where $thedate > $latestdate VALUES('', '$name', '$content', '$thedate';

 

Where the dates have been stored as:

 

Sun Jun 28 22:03:41 +0000 2009

 

So

 

 

INSERT INTO backup where 
Sun Jun 28 22:03:41 +0000 2009 > 
Sun Jun 28 22:00:21 +0000 2009 VALUES('', '$name', '$content', '$thedate';

 

But can i compare dates like this?

Posted
You can't compare complex dates like that in MySQL, only dates stored as integers. You'll have to do a select from the database, use strtotime() on the retrieved date, compare it to time(), and do an insert if appropriate.
Posted
You can't compare complex dates like that in MySQL, only dates stored as integers. You'll have to do a select from the database, use strtotime() on the retrieved date, compare it to time(), and do an insert if appropriate.

 

It looks like to me he has already pulled them into PHP varibles.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...