I'm sending json to the server like this:

```
{"data":{"tags":[{"tag":"Paris"},{"tag":"New York"},{"tag":"London"}]},"terms":{"term":"index"}}

```

... and with foreach() I'm appending the provided tags to the query:

```
$query = "SELECT name FROM accounts 
WHERE name = '".$term."'";
foreach($tags as $t=>$tag){
    $tag = $tag['tag'];
    $query.=" AND city = '".$tag."'";
}

```

... to replicate this:

```
SELECT name FROM accounts 
 WHERE name=$term 
 AND city=$tag
 AND city=$tag 
 AND city=$tag;

```

But how should the foreach() look like if I want to provide replicate this:

```
SELECT name FROM accounts 
 WHERE name=$term 
 AND (city=$tag OR city=$tag OR city=$tag);

```