Yohanne Posted September 6, 2013 Share Posted September 6, 2013 (edited) Hi coders, may i ask, how to correct this. "SELECT .... WHERE rmonth && rday && ryear between '$_POST[month1]$_POST[day1]$_POST[year1]' AND '$_POST[month2]$_POST[day2]$_POST[year2]'"; Edited September 6, 2013 by jayson_ph Quote Link to comment https://forums.phpfreaks.com/topic/281911-between-two-date/ Share on other sites More sharing options...
Muddy_Funster Posted September 6, 2013 Share Posted September 6, 2013 may we ask what's broken about it? Quote Link to comment https://forums.phpfreaks.com/topic/281911-between-two-date/#findComment-1448422 Share on other sites More sharing options...
Yohanne Posted September 6, 2013 Author Share Posted September 6, 2013 no error found and no result found or data found.. and i dont know if mysql allow like syntax below that after "WHERE" there are multiple field name before condition. because the date where i have here is separated field name. table ------------------------------ |month | day | year | ------------------------------ 08 01 2013 08 21 2013 09 17 2013 WHERE rmonth && rday && ryear CONDITION Quote Link to comment https://forums.phpfreaks.com/topic/281911-between-two-date/#findComment-1448427 Share on other sites More sharing options...
Barand Posted September 6, 2013 Share Posted September 6, 2013 To compare dates you need the elements of the date in YMD order ie CONCAT(ryear,rmonth,rday). Use MySQL DATE type fields for date storage (format yyyy-mm-dd) Quote Link to comment https://forums.phpfreaks.com/topic/281911-between-two-date/#findComment-1448437 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.