[eluser]rajneeshgobin[/eluser]
i have this array
Array ( [0] => stdClass Object ( [groupID] => 6 ) [1] => stdClass Object ( [groupID] => 7 )
and these tables
log [table] -> activity participated by student
id
studentname
groupID
activity
ie
log
id ; studentname ; groupID ; activity
1 : paul : 6 : swim
2 : jack : 7 : swim
3 : anu: 7 : dance
4 : rita: 7 : read
5 : malwin: 2 : swim
user_group
id
userID
groupID
ie
id : userID groupID
1 : 1: 7
2 : 2: 7
3 : 3: 7
4 : 1: 6
5 : 2: 6
basically a student can be part of many groups which is recorded in the user_group table
a student wish to get all the log for himself and students in same group as him
ie if student is in group 7,6 he wish to get all the log of his friends with groups, 7 , 6
with a query i got this which give me corectly the group id associated by the student
Array ( [0] => stdClass Object ( [groupID] => 6 ) [1] => stdClass Object ( [groupID] => 7 )
$this->db->select("log.studentname ", FALSE);
$this->db->select("log.groupID ", FALSE);
$this->db->select("user_group.groupID", FALSE);
$this->db->from("log");
$this->db->join("user_group", "log.usergroup = user_group.groupID");
$this->db->where('user_group.groupID', '7'); // here i hard code '7'
return $this->db->get('log', $limit, $offset);
[/code]
instead of the '7' in hard code i wished to pass the array as the where clause so that i can get where group = 6 OR group =7