cooldude832 Posted May 26, 2007 Share Posted May 26, 2007 I want to be able to search by things with a certain date field like: Last 10 days last 5 days last 3 day yesterday today and I have a field that is a Date so I want to say WHERE CDate >= '$searchdate'; I do this, but its altering my year not day $temptoday = date("Y-m-d"); $tempcdate = $temptoday-$searchc['date']; $critera .= "WHERE CDate >= '".$tempcdate."' "; $whereset = "yes"; Quote Link to comment https://forums.phpfreaks.com/topic/53046-solved-mysql-date-field-help-with-searching/ Share on other sites More sharing options...
cooldude832 Posted May 26, 2007 Author Share Posted May 26, 2007 I've reworked it, but still no good $tempcdate = mktime(0,0,0,date("m"),date("d")+$search['date'],date("Y")); $tempcdate = date("Y-m-d", $tempcdate); Quote Link to comment https://forums.phpfreaks.com/topic/53046-solved-mysql-date-field-help-with-searching/#findComment-262033 Share on other sites More sharing options...
cooldude832 Posted May 26, 2007 Author Share Posted May 26, 2007 problem solved I had the + instead of - for subtracting days Quote Link to comment https://forums.phpfreaks.com/topic/53046-solved-mysql-date-field-help-with-searching/#findComment-262035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.