Welcome Guest, Not a member yet? Register   Sign In
using the $this->table->generate
#5

[eluser]alvaroeesti[/eluser]
Thank you. I got it working by returning from the Model this

Code:
$query = $this->db->get();
return $query;
Instead of the array I had before.

Now, I was using that array for other things, for example to generate a map, doing this:
Code:
$marker = array();
foreach($data as $lugar)
{
$marker['regiones'] = $lugar->nombre_region;
$marker['position'] = $lugar->nombre_localidad;
$this->googlemaps->add_marker($marker);
}


Since I don't have the array now, I don't know how to do the same with the object that I was doing with the array (looping through to get the results). I still don't quite get the workings with objects as used to old procedural.
$data was what I was getting from the Model when I returned the array and not the query object.

This case illustrates something that is used all the time (but I use it without fully understanding why is this so)

For example. When I put as receiver of the array returned by the model, something like you can see in the map example, just $data, it is an array alright, and you loop through it.

However, when you are going to send something to the view, it is not enough to have just the $data, but you have to add the square brackets and put an index in it. You will use this index in the View to loop through it as if it were an array again.

Is this something from codeigniter, it this something from the MVC frameworks, is this plain PHP ?


regards


A



Messages In This Thread
using the $this->table->generate - by El Forum - 10-12-2012, 10:24 AM
using the $this->table->generate - by El Forum - 10-12-2012, 03:19 PM
using the $this->table->generate - by El Forum - 10-12-2012, 05:04 PM
using the $this->table->generate - by El Forum - 10-12-2012, 07:35 PM
using the $this->table->generate - by El Forum - 10-13-2012, 12:10 AM
using the $this->table->generate - by El Forum - 10-13-2012, 01:06 PM
using the $this->table->generate - by El Forum - 10-13-2012, 01:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB