Welcome Guest, Not a member yet? Register   Sign In
confusion with where query and arrays
#4

[eluser]martynrlee[/eluser]
Thanks mddd,

That works, think I am just over complicating things as I am stuck again - trying to do the following:

I have an array of colours received through ajax. So, (blue, green, red) for example.

I have three columns in a database. colour1, colour 2, colour 3. I am trying to do

$this->db->where_in('colour1', $colourArray);
$this->db->or_where_in('colour2', $colourArray);
$this->db->or_where_in('colour3', $colourArray);

I also need to do the following (if anything contained in the arrays):

$this->db->where_in('style', $styleArray);

and

$this->db->where_in('paint', $paintArray);

However as soon as I use 'or_where_in' this will reference against the 'style' and 'paint'.

The idea is that the user can drill down through a menu in real time selecting either by colour, style or paint. I guess my main issue is that there can be up to 3 colours and only 1 style and 1 paint type.

I have also tried putting all 3 colours into a comma separated field but then couldnt work out how to do:

$this->db->where_in($colourColumnArray, $colourArray);

What do you think?

All help with this most appreciated.

Martyn.


Messages In This Thread
confusion with where query and arrays - by El Forum - 08-25-2010, 07:32 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 08:02 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 09:46 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 09:53 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:00 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:27 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:33 AM
confusion with where query and arrays - by El Forum - 08-25-2010, 10:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB