Welcome Guest, Not a member yet? Register   Sign In
Trying to get property of non-object - Need Help
#1

[eluser]barisv[/eluser]
Hi,

I am trying to show messages that comes from customers to the admin from contact page. But when I'm trying to retrieve data, it gives me an error sth like "trying to get property of non-object".

I couldnt figure out what I doing wrong. When I retrive data by using CI table class, it works just fine, but when I trying to retrieve data one by one, it doesnt work.

The related function of the controller

Code:
function musteri_mesajlari()
    {
        $this->load->library('pagination');
        

        $config['base_url'] = 'http://localhost/adminpanel/admin/musteri_mesajlari';
        $config['total_rows'] = $this->db->get('messages')->num_rows();
        $config['per_page'] = '10';
        
        $this->pagination->initialize($config);
        
        
            $data = array(
            
                'main_content' => 'musteri_mesajlari',
                'username' => $this->session->userdata('username'),
                'records' => $this->db->get('messages', $config['per_page'], $this->uri->segment(3))
            );
        
        $this->load->view('includes/admin_template',$data);
    }

The related view

Code:
<div id="main">
            
            
                &lt;?php if(isset($records)) :    
                    
                            foreach($records as $row)
                              {
                                  echo $row->name;
                             }
                    
                ?&gt;
                
                &lt;?php else : ?&gt;
            
                No records were returned.
                    
                &lt;?php endif; ?&gt;
                    
                
                &lt;?php echo $this->pagination->create_links(); ?&gt;
            
            
        </div>

Thanks in advance.


Messages In This Thread
Trying to get property of non-object - Need Help - by El Forum - 02-07-2011, 05:54 AM
Trying to get property of non-object - Need Help - by El Forum - 02-07-2011, 08:03 AM
Trying to get property of non-object - Need Help - by El Forum - 02-09-2011, 11:43 PM
Trying to get property of non-object - Need Help - by El Forum - 02-10-2011, 03:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB