[eluser]Unknown[/eluser]
This seems like a very common requirement to me, and I am new to CI.
I am trying to achieve this to be able to display multiple profiles for a user_id (tank auth)
e.g. my model has: -
Code:
function Get_user_profiles($user_id)
{
$this->db->where('user_id', $user_id);
$query = $this->db->get('user_profiles');
if ($query->num_rows() >= 1) return $query->result();
return NULL;
}
this will return multiple records for personal profile, company profile etc (this is as per my design).
Note: I am able to implement the form for single record returned e.g.
Code:
if ($query->num_rows() == 1) return $query->row();
In controller I do something like : -
Code:
$data['profiles'] = ...Get_user_profiles($session_user_id);
and later pass $data during view load.
How can I build my form to handle multiple record. Is there some code generator/module or can someone help me with code snippets to create view file, and correctly form_validate the multi-record fields ?
Another important thing is that I want to use this form to view as well edit the fields for all profiles.
Thanks in advance.