(12-12-2015, 04:04 PM)solidcodes Wrote: You can use one to many relationship, so the table must look like this below,
Code:
Organization
-------------------------------------
org_id | person_id | more columsn here ....
-------------------------------------
People
-------------------------------------
person_id | more columsn here ....
-------------------------------------
The Query
Code:
function get_record_by_id($person_id)
{
$q = $this->db->select('org_id, person_id, organization')
->from('organization')
->where('person_id', $person_id)
->limit(1)
->get();
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
//$data[] = $row;
$data = $row->organization;
}
return $data;
}
}
Not tested buy try...
thank you very much for your help.. sorry it took so long to get back here but life happens.. again thanks much