[eluser]mtbkrdave[/eluser]
Hi All-
I'm using the Active Record Class, and I'd like to use the results from database query to select the rows for a second. I query one table for a list of key IDs, then I want to go back to the table to which the keys refer, and select all the original rows.
My question is: Can the $this->db->or_where() function be used as the
first function in a series of select functions? I'd like to run through the
first query using a foreach() loop, and with each pass through the loop add a new or_where() selection for the
second query.
Code:
$this->db->where('id',$key_id);
$query1 = $this->db->get('mytable');
if( $query->num_results() > 0 ){
foreach($query->result() as $row){
$this->db->or_where('key',$row->id);
}
return $this->db->get('parent_table');
}
Is there a more-efficient way to do this??!
Thanks,
[medic]Dave