Jump to content

Recommended Posts

Is it possible to achieve a similar thing to this...

 

SELECT FROM db WHERE value!=$array

 

My example code is this:

 

$browser_hide = array("1" => "YandexBot 0.0 for unknown");

$query = "SELECT * FROM hitlist_hits WHERE month='$month' AND browser!='$browser_hide' ORDER by id DESC";

 

Thanks Guys.

Link to comment
https://forums.phpfreaks.com/topic/214316-select-from-db-where-valuearray/
Share on other sites

Seriously, you waited a whole 12 minutes before bumping your thread. Perhaps the lack of responses is due to the lack of clarity in your request. I *assume* you are wanting to find records where the value does not exist in the values of the array.

 

The query would use the operator "NOT IN" followed by a list of values.

$values = "'" . implode("','", $browser_hide) . "'";
$query = "SELECT *
          FROM hitlist_hits
          WHERE month='$month'
            AND browser NOT IN ($values)
          ORDER by id DESC";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.