简体   繁体   中英

Mysql get results from todays date and forward

I am using opencart and wrote a new module to grab products that are coming soon. yet it still shows products even from before todays date.

my sql statement:

SELECT *, DATE_FORMAT(date_available, "%M %d, %Y") as `comingdate` FROM `product` WHERE `date_available` >= '.DATE("Y-m-d").' ORDER BY `date_available` DESC LIMIT 20

what is wrong with that statement?

"SELECT *, DATE_FORMAT(date_available, '%M %d, %Y') as `comingdate` FROM `product` WHERE `date_available` >= '".date('Y-m-d')."' ORDER BY `date_available` DESC LIMIT 20"

Remember, date_available is a string. You need the single quotes there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM