flaab Posted June 8, 2007 Share Posted June 8, 2007 Hi =) I'm building an application and I need to SELECT a bunch of rows WHERE date is < today. I tried like this but it does not work. SELECT id FROM `reserva` WHERE fh_salida < '$today' AND (estado = 'P' OR estado = 'C') I mean i need all rows where the date field called fh_salida is before that TODAY. How can i do that? Thx. Quote Link to comment https://forums.phpfreaks.com/topic/54710-mysql-need-to-get-all-rows-with-a-date-field-as-selector/ Share on other sites More sharing options...
flaab Posted June 8, 2007 Author Share Posted June 8, 2007 Well that expression works, but returns every row with fh_salida not null. Quote Link to comment https://forums.phpfreaks.com/topic/54710-mysql-need-to-get-all-rows-with-a-date-field-as-selector/#findComment-270561 Share on other sites More sharing options...
jaikar Posted June 8, 2007 Share Posted June 8, 2007 are you sure that the fh_salida column type in the MYSQL database is set to DATE ?... that query will work only if fh_salida type is set to date... not sure if it will work with datatime type, also make sure $today is in Y-m-d format.... Quote Link to comment https://forums.phpfreaks.com/topic/54710-mysql-need-to-get-all-rows-with-a-date-field-as-selector/#findComment-270568 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.