Welcome Guest, Not a member yet? Register   Sign In
How do i create a loop in a view file or move to model??
#11

[eluser]123wesweat[/eluser]
ah found it i forgot to assign the model method to a variable like so

Code:
$query = $this->jobs_model->get_jobs_limit($config['per_page'],$numOfJobs);
        $dataTable['jobs'] = $query->result_array();

edit: why do i get
Code:
Array
(
    [0] => Array
        (
#12

[eluser]ciGR[/eluser]
Nice, but I think its better to call the result_array() inside your model
Code:
return $q->result_array();
and in your controller
Code:
$dataTable['jobs'] = $this->jobs_model->get_jobs_limit($config['per_page'],$numOfJobs);

It's ok to take this 2dimension array, you simple have an array with results and each row of this array it's also an array with rows the fields of the jobs.

If instead of $q->result_array you use $q->result you will get an array of objects.
#13

[eluser]123wesweat[/eluser]
..




Theme © iAndrew 2016 - Forum software by © MyBB