So I’m trying to build a query string based on user input.
So if certain fields are filled out, additional conditions are added to the string.
Here’s what I’ve built up
[code]
SELECT * FROM `mytable` WHERE (rowID IN (:varA) OR row2ID IN (:varB)) AND DATE(:entryDate) BETWEEN ‘:startDate’ AND ‘:endDate’ ORDER BY DATE(entryDate) DESC
I’m getting the follow error
>
**Warning
> : PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in
> **/home2/public_html/mysite/search.php
> on line
> **116
When I log this
[code]
error_log($stmt->debugDumpParams() );
I get this
>
SQL: [212] SELECT * FROM `table
I’m build the where clause, then entering into the rest of the $SQL string, doing the PDO prepare line and then adding in the params.