[eluser]TheFuzzy0ne[/eluser]
I can see four problems with your getname method.
1) You should ditch the closing ?> PHP tag. It's not needed, and is not useful since it's the cause of a well known problem.
2) I'd strongly suggest adding underscores to your method name, and variables.
3) You are making your database query before setting the WHERE clause, which is why it's still there after you think you've made the first query.
4) You are not adding to the name array, you're only overwriting it with a string.
Here's my proposed replacement function for getname:
Code:
public function get_names($id){
$this->db->where('IDtype', $id);
$res = $this->db->get('types',1);
$names = array();
if ($res->num_rows() > 0)
{
$res = $res->result_array();
foreach ($res->result() as $row)
{
$names[] = $row->nom_type;
}
}
return $names;
}