0

I have the following mysqli query:

$query = "SELECT * FROM `products` ORDER BY product_price ASC";

I would like to only query posts which have a certain date or a date greater than the one set below in $date. I have tried the following:

$date = '2016-02-28';
$query = "SELECT * FROM `products` WHERE last_updated > $date ORDER BY product_price ASC";

Is this the right approach? My dates are currently stored like this:

2016-03-01 07:18:17

Any help would be appreciated.

danyo
  • 5,431
  • 16
  • 57
  • 114

1 Answers1

0
SELECT * FROM `products` WHERE `date` > '2012-11-18' ORDER BY `product_price` ASC;

if you want to have a go try this jsfiddle

This answer will probably cover your question

Community
  • 1
  • 1
DevilCode
  • 982
  • 2
  • 33
  • 57