Select record from database by date Date

[#] select * FROM table WHERE date < now(‘d/m/Y’)
im trying to select from the database by (date less than now) im assuming it was something like this but it didn’t work, also I am unable to find a solution. I believe the problem is that the values are strings but is there a way i can do this ?
Please help me (AGAIN!!!) :slight_smile:

Hi there,

What exactly is the goal? Find rows where the date in the field date is yesterday or before?

dates previous of today :slight_smile:

Try the following:

SELECT * FROM `table` WHERE DATE(`date`) < DATE(NOW())

no idea what date(now()) is but it dont like it.

[php]$result = mysql_query(“SELECT * FROM test
WHERE deadline < date(‘d-m-Y’)”);[/php]
the format of the date in the database is (d-m-Y) e.g 18-12-2011 please help :slight_smile:

[php]$date = date(d-m-Y);
$result = mysql_query(“SELECT * FROM test
WHERE className =’$class’ AND deadline > ‘$date’”);[/php]
not to worry this worked i created a variable to hold the date then used that. no idea why that is different to what i done before but never mind cheers for your help. :stuck_out_tongue:

[php]WHERE Test.deadline < ‘date(d-m-Y)’ AND Class.userID =’$_SESSION[SESS_MEMBER_ID]’;");[/php]
just realised its not working i thought it was but as mistaken someone please help

Sponsor our Newsletter | Privacy Policy | Terms of Service