[eluser]Mike Ryan[/eluser]
You are overwriting the $data array each time you go through the loop, so it will only contain the last entry.
This would work:
Code:
foreach ($query->result_array() as $row)
{
$data[] = array(id => $row['id'],
prod_name => $row['prod_name'],
prod_descr_short = $row['prod_descr_short']
);
}
I'm not sure why you are looping through the array to copy it. Why not just return that value directly?
Code:
$sql = 'SELECT id, prod_name, prod_descr_short FROM products';
$query = $this->db->query($sql);
//error checking goes here!
return $query->result_array();