I have a website with a simple PHP query that return records from a MYSQL table without issue.
$query = mysqli_query( $connection, "SELECT * FROM $shopname
I am trying to figure out how to only return the last 5 days of records based on a field called "date". The date field is a VARCHAR type in mysql. The format of the dates in the date field are like this: 8/9/2016 5:52:17 PM. I did try the following query from some researching, but this doesn't return anything. What am I doing wrong?
$query = mysqli_query( $connection, "SELECT * FROM $shopname WHERE `date` >= DATE_SUB(CURDATE(), INTERVAL 5 DAY)");
*IMPORTANT - I can't change mysql field to DATE. It has to be VARCHAR.