php - Nice way to pass parameters to PDO -


When working with 3 or 4 criteria, the status criteria become a nightmare. Nominated parameters are verbose I'm thinking of doing:

  query ("user WHERE user name =", $ username, "and password =", $ password)  

with dynamic parameters (using func_get_args () ), each other is being converted into a positional parameter.

I have never seen this before and wanted to know that someone has done this before and why / why not?

This is a smart idea. I see that there is only one problem that the SQL and pass-in variable How to differentiate between Unless you do not make a assumption that every other ARG is a variable I think the perception is delicate, and makes things unclear, makes things more clear than that.

A better method might be the use of interpolation:

  query ("SELECT foo FROM bar WHERE id = # {id}", array ("id" = & Gt; "23"));  

Then type the argument to launch them.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -