0

I want to get all the results but the ones in the array $valuesnew.

$query = "SELECT * FROM venue
        WHERE venue_id IN ($valuesnew)";

Is there a fast way to do this?

1
  • 1
    $valuesnew contain string or is numeric ? Commented May 14, 2014 at 9:56

4 Answers 4

1
$query = "SELECT * FROM venue
    WHERE venue_id NOT IN ('".implode("','",$valuesnew)."')";
Sign up to request clarification or add additional context in comments.

Comments

0
SELECT * ROM venue WHERE NOT venue_id ($valuesnew)

NOT Operator negates your condition.

Comments

0

Maybe:

$query = "SELECT * FROM venue
        WHERE venue_id **NOT** IN ($valuesnew)";

Comments

0
select * from table where column NOT IN ('value1','value2','value3');

3 Comments

Values must be surrounded by quotes !
no. Strings need to be surrounded by quotes. Read more about data types
He uses the variable $valuesnew, so it may lead to SQL injections if you don't know what is actually in $valuesnew. Although it's not sufficient to secure the query...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.