Don’t wrap the values with single quote.
$STH = $DBH->prepare("SELECT * FROM `table` WHERE `start_date` BETWEEN :start_date AND :end_date");
More Related Contents:
- How to apply bindValue method in LIMIT clause?
- How to properly set up a PDO connection
- Getting raw SQL query string from PDO prepared statements
- PDO with INSERT INTO through prepared statements [closed]
- Use bound parameter multiple times
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- Do SQL connections opened with PDO in PHP have to be closed
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE `id` [closed]
- Cleansing User Passwords
- SELECT COUNT(*) AS count – How to use this count
- How can I use PDO to fetch a results array in PHP?
- PHP PDOException: “SQLSTATE[HY093]: Invalid parameter number”
- selecting unique values from a column
- MySQL check if a table exists without throwing an exception
- Create a dynamic mysql query using php variables
- How to separate DATE and TIME from DATETIME in MySQL?
- Replacing mysql_* functions with PDO and prepared statements
- PDO + MySQL and broken UTF-8 encoding
- PDOstatement (MySQL): inserting value 0 into a bit(1) field results in 1 written in table
- php code to test pdo is available?
- PDO fetchAll group key-value pairs into assoc array
- MySQL skipping first row
- How to reverse order output of a MySQL query
- PDO MySQL: Insert multiple rows in one query
- Binding parameters for WHERE IN clause with PDO [duplicate]
- How would I implement a simple site search with php and mySQL?
- How to escape single-quote (apostrophe) in string using php
- php, mysql – Too many connections to database error
- SELECT row by DATEPART()
- Insert value list does not match column list: 1136 Column count doesn’t match value count