Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDO Parameterized Query - Reuse named placeholders?

Tags:

In essence, I have a value that I have to call a couple times in my SQL query. Thus, is it possible to reuse the same named placeholder in the statement e.g. SELECT :Param FROM Table WHERE Column = :Param, then simply bindValue(":Param"), and have the value be there for both :Params?

like image 472
gamers2000 Avatar asked Mar 12 '10 10:03

gamers2000


1 Answers

PDO::prepare states that "you cannot use a named parameter marker of the same name twice in a prepared statement", so I guess that's a no then.

like image 147
gamers2000 Avatar answered Sep 21 '22 18:09

gamers2000