I
I
ImVeryStupid2020-04-14 17:18:43
PHP
ImVeryStupid, 2020-04-14 17:18:43

IN AND NOT IN in one query?

Two options (with and without pseudo-variables) how to make IN in PDO are well described here:
https://phpdelusions.net/pdo#in

But how to make two (upd: two identical) IN correctly?
Without pseudo-variables, you will have to merge the array with itself.
And one pseudo-variable cannot be used more than once in a query.

Which of the two evils is the lesser?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-04-14
@ImVeryStupid

The link has all the answers.
If you use positional "pseudo-variables", then just merge two arrays - one for in, the second for not in.
If you use named "pseudo-variables", then first prepare two arrays, with different variable names , and then simply merge them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question