⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set_relation multiple where



mavershim
  • profile picture
  • Member

Posted 10 May 2012 - 08:46 AM

Hi,

is there a way to put multiple where(and/or) in set_relation?

carlinchisart
  • profile picture
  • Member

Posted 11 May 2012 - 02:01 AM

http://www.grocerycrud.com/documentation/options_functions/set_relation

[color=#2C575B][font=Arial, Tahoma, Helvetica, sans-serif]
You can also have a where clause at the 4th parameter (is not a required parameter). For example:[/font][/color][color=#2C575B][font=Arial, Tahoma, Helvetica, sans-serif]


[color=#0000FF]$crud[/color]->[color=#006600]set_relation[/color][color=#66CC66]([/color][color=#FF0000]'user_id'[/color],[color=#FF0000]'users'[/color],[color=#FF0000]'username'[/color],[color=#000066]array[/color][color=#66CC66]([/color][color=#FF0000]'status'[/color] => [color=#FF0000]'active'[/color][color=#66CC66])[/color][color=#66CC66])[/color]; [/font][/color]

mavershim
  • profile picture
  • Member

Posted 12 May 2012 - 03:25 AM

I know this but i want is to add addition where that will create something like this
where status ='active' or status ='done' etc..

int the 4th parameter i tried putting multiple value for the status but it only accept the last value of the array

my code is
[color=#2C575B][font=Arial, Tahoma, Helvetica, sans-serif][color=#66CC66]

$crud->set_relation('user_id','users','username',array('status' => 'active','status'=>'prospect'));
[/color][/font][/color][color=#2C575B][font=Arial, Tahoma, Helvetica, sans-serif][color=#66CC66]'')[/color][color=#66CC66])[/color]; [/font][/color]

I know that this must create a statement using both and will use and but it will only show rows with the status ='prospect' and also want to use or on the where statement. will show both status ='active' or status ='prospect'.