Welcome Guest, Not a member yet? Register   Sign In
require all values in array to be matched when using where_in
#1

[eluser]Andy UK[/eluser]
Hi,

I have an array of active features which i'm using to filter a result set. The array is stored in an environment variable and each time a user selects a feature, the results are filtered and the filter options are also reduced to reflect which ones are now available. For example when searching for a property the following filters might be available:

Furnished (27)
Fireplace (6)

If i choose the Fireplace filter, we might get a new set of feature options like this:

Furnished (5)
Fireplace (6)

Because there are only 5 furnished properties that also have a fireplace.

The features array will now have one value in it which is that of the fireplace feature id. However, if I also select Furnished, i'm back to where i started with the following:

Furnished (27)
Fireplace (6)

This is because i'm using where_in to check if the values are in the features array. What i really want is for all the values in the array to be matched and not just one or another. The line in question is:

Code:
$this->db->where_in('feat_prop_join.feature_id', $this->session->userdata('selected_features'));

Am I right in thinking that where_is is satisfied just as long as one of the values appears in the array? What can I use to require all the values to be matched?

Many thanks!


Messages In This Thread
require all values in array to be matched when using where_in - by El Forum - 08-27-2014, 05:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB