[eluser]dimis[/eluser]
I have 3 tables.
One it the products, the second is the text for each product for each language (English,german etc).
The other is some information for each product.
I have this code at my model
Code:
function ReturnTopTen($id,$lan)
{
$data = array();
$this->db->select('id,note');
$this->db->from('products_view');
$this->db->where("visible='1'and lan_code='$lan'");
$this->db->limit(10);
$query= $this->db->get();
if ( $query-> num_rows() > 0){
foreach ( $query-> result_array() as $row){
$data['product'][] = $row;
$data['code'][]=$this->ReturnFirstColor($id);
}
return $data;
}
}
function ReturnFirstColor($id)
{
$data = array();
$this->db->select('code_photo');
$this->db->from('product_code');
$this->db->where("product_id=",$id);
$this->db->limit(1);
$query= $this->db->get();
if ( $query-> num_rows() > 0){
foreach ( $query-> result() as $row){
$data['code_photo'] = $row->code_photo;
}
return $data;
}
}
and I call this at controller
Code:
$this->data['producer'] = $this->client_producer->ReturnProducer($a,$this->session->userdata('lan'));
{ $mykey="'$key'";
echo $list['code_photo'];;
}
But there is an error
Quote:Severity: Notice
Message: Undefined index: 'product','code'
How can I do loop at this array and to take the values or maybe another way?
Dimis