I have a query that looks like this:
SELECT CONCAT('path/to/page/?id=', id) AS link FROM users WHERE name = ?
I use PDO to prepare this statement and I get an error
Invalid parameter number: number of bound variables does not match number of tokens
as he considers the question mark in the CONCAT line to be a placeholder.
Is there a way to avoid the question mark, so PDO knows this is not a placeholder?
Please do not leave comments about other ways to get the link. I am changing the old code that is part of the old template engine, so it would be a lot less work to find a way to avoid the question mark than not putting the question mark in the request.
source
share