Welcome Guest, Not a member yet? Register   Sign In
Array To String error / undefined $query
#1

I'm learning CodeIgniter 3 and have come to a halt because of a (probably) stupid thing I did. Could you help me in identifying the issue in my code?
I'm trying to display some rows of data from a database and I get this error
Quote:A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: core/MY_Controller.php Line Number: 24 Backtrace:
File: /public_html/siiga/application/core/MY_Controller.php Line: 24 Function: _error_handler
File: /public_html/siiga/application/core/MY_Controller.php Line: 45 Function: render
File: /public_html/siiga/application/controllers/admin/Docs.php Line: 74 Function: render
File: /public_html/siiga/index.php Line: 315 Function: require_once
My Controller
Code:
 public function existing() // Recieved, Unsolved
 {
     $this->load->database();
     $this->load->model('Docs_model');
     $this->load->library('table');
     $data['query'] = $this->Docs_model->viewexisting();
     $this->render('admin/docs/existing_view', $data);
 }
My Model
Code:
public function viewexisting()
{
   $query = $this->db->query("SELECT * FROM docs");
   return $query->result();  
}
My View
Code:
<?php foreach($query as $row){?>
<table>
   <tr>
       <td><?php echo $row->numar_inreg ;?></td>
       <td><?php echo $row->nume_doc ;?></td>

<?php }?>

Help? Please?
Reply


Messages In This Thread
Array To String error / undefined $query - by CodinMoldovanu - 08-14-2016, 06:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB