PDO positional and named parameters as part of the same prepared query?

Yes, it's impossible PDO. Prepare You cannot use both named and question mark parameter markers within the same SQL statement; pick one or the other parameter style.

Yes, it's impossible. PDO. Prepare You cannot use both named and question mark parameter markers within the same SQL statement; pick one or the other parameter style.

Ok thanks for the info. Considering I have a variable number of parameters, is it then impossible to bind variables to the ORDER BY and LIMIT clauses? (As I understand it, you can only do this with named parameters.

But named parameters do not lend themselves to situations with an unknown number of parameters. ) – Travis Jun 24 '10 at 9:27 1 You can't bind column names, so you can't bind :sort and :dir . Give names to all parameters.

– Naktibalda Jun 24 '10 at 10:19.

Use a wrapper function, a naive replacement function will suffice. If (strpos($sql, ":")) { $i = -1; while (strpos($sql, "? ") && isset($parameters++$i)) { $parameters":p$i" = $parameters$i; unset($parameters$i); $sql = preg_replace("/?

/", ":p$i", $sql, 1); } } Mix $sort and $dir directly into the $sql query. These two are SQL identifiers, not data.

I'm learning the ropes with PDO. Here is my sql (the number of parameters that can appear in the WHERE is variable). Is it impossible to combine positional and named parameters in the same query?

Or am I missing something?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions