Suppose I have this query:
SELECT * FROM 'users' WHERE ( username = 'foo' OR email = 'bar' )
How would I make it so, that query uses ? marks instead of passing values in directly. eg.
SELECT * FROM 'users' WHERE ( username = ? OR email = ? ...
And have input specified within WHERE () clauses if possible.
EDIT: I've read somewhere a while ago that using ? marks in queries improves performance and helps with sql injections. This is what I am trying to do here.
?is used to define place holders. And are used with prepared statements. What is it that you are trying to do?mysql/psqlinterface? From within a procedure? Or perhaps through some language's database interface? And are you using MySQL or PostgreSQL? I'm guessing the former since PostgreSQL would complain about'users'.