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. 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. 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.... 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
Archived
This topic is now archived and is closed to further replies.