As I mentioned, I still do not have very clear what you want to do but I hope I can help you, and if you add a little more information I can help you in your problem.
Model:
function getClientes(){
$sql = "SELECT * FROM clientes";
$query = $this->db->query($sql);
if($query->num_rows()>0){
return $query;
}
}
Controller:
function procesaCliente(){
$getClientes = $this->myModel->getClientes();
foreach ($getClientes->result() as $row){
$id = $row->id;
$nombre = $row->nombre;
$ubicacion = $row->ubicacion;
$telefono = $row->telefono;
}
}
What I do is in the function of the model return the entire object $query
for in the controller assign the method of the model to a variable in the controller to be able to process the array that returns the function.
In your case you could grab the function to a variable in the following way:
$getClientes = $this->myModel->getClientes();
When trying to get the index like this:
$getClientes[0]['id']
Edition 1:
What you want is to go through the entire array in the view you do the following in your controller:
function procesaCliente(){
$getClientes = $this->myModel->getClientes();
//Paso el array completo a la vista.
$this->load->view('vista', $getClientes);
}
And in the view you go through the array in the following way:
foreach ($getClientes->result() as $row){
$id = $row->id;
$nombre = $row->nombre;
$ubicacion = $row->ubicacion;
$telefono = $row->telefono;
}