Jump to content

Query with time difference


Logical1

Recommended Posts

Hello

I save the date of record creation in a colum called PDate in MySQL and use the following querry:

$Tdate = date('Y').date('m').date('d');

$query = "SELECT Id FROM tblItems $TDate-PDate < '3' AND Status = '1'";

 

This is to show only records that are less than 3 days old.

This method has always worked but suddenly I am getting no answers!

I did some tests and I see that if :

TDate = 20090801

PDate = 20090729

What am I doing worng?

 

 

Link to comment
https://forums.phpfreaks.com/topic/168446-query-with-time-difference/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.