Skip to content
Advertisement

PDO and MySQL ‘between’

I’m trying to get PDO to work with a MySQL ‘between’. Below is my code:

JavaScript

What gets returned is an array with ‘0’ or ‘NULL’ for values. When I hard code the end date, it acts as if start_date is set to -1, retuning me all rows before the end_date. So, what am I doing wrong here?

Advertisement

Answer

Don’t wrap the values with single quote.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement