Matthew Warner
Matthew Warner

Reputation: 3

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?

Upvotes: 0

Views: 165

Answers (1)

Kai Qing
Kai Qing

Reputation: 18843

"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.

Upvotes: 1

Related Questions