Welcome Guest, Not a member yet? Register   Sign In
Newbie with a query questions. Results not getting passed to view.
#1

[eluser]ThanksBrah[/eluser]
Hola.

As stated, the results are not getting passed to my view.

here's what I have:

Controller:

Code:
$this->load->model('membership_model');
        
        $results= $this->membership_model->search();
        
        $data['organizations'] = $results['rows'];
        $data['num_results'] = $results['num_rows'];
            
        $this->load->view('members_area', $data);


Model:
Code:
function search()
    
    {
        //results
        $query = $this->db->select('orgID, FLName, eGRANT_ID')
                                ->from('organizations');
        
        $results['rows'] = $query->get()->result();
        
        
    
            
    }

View:

Code:
<?php var_dump($organizations); ?>
    
    <tbody>
    &lt;?php foreach($organizations as $org): ?&gt;
    
    <tr>
      <td>&lt;?php $org->orgID; ?&gt;</td>
      <td>&lt;?php $org->FLName; ?&gt;</td>
      <td>&lt;?php $org->eGrant_ID;?&gt;</td>
    </tr>
    
    &lt;?php endforeach; ?&gt;
    
    </tbody>

I added var_dump() and the parameter '$organizations' is null giving me a Invalid argument supplied for foreach() error.

Can anyone see what I'm doing wrong?

Thanks
#2

[eluser]slowgary[/eluser]
Your model's search() function doesn't return any data Smile




Theme © iAndrew 2016 - Forum software by © MyBB