Welcome Guest, Not a member yet? Register   Sign In
MySQL, Querybuilder, Controller problems... ERR 2014
#1

Hello everyone,

I'm new to CI and haven't been into php for quite a while and now I'm stuck and don't get it to run. Tought it'd be an easy task, so in short:

Using a controller "Suppliers" which has a method "details", which will then call a view containing general details and a list of entries from another table. The view tells me that an error occured: 

Code:
Error Number: 2014

Commands out of sync; you can't run this command now

So to get the info needed:

My Controller
PHP Code:
class Suppliers extends CI_Controller {

 
       public function __construct()
 
       {
 
           parent::__construct();
 
           $this->load->model('suppliers_model');
 
           
            
            
//Check if logged in already
 
           session_valid();
 
       }

public function 
details($id NULL)
 
       {
 
           $data['supplier'] = $this->suppliers_model->get_supplier($id);
            if (empty($data['supplier'])) show_404();

            $data['certificates'] = $this->suppliers_model->get_supplier_certificates($id);


            $data['title'] = $this->lang->line('supplier'FALSE) . ': ' $data['supplier']['name'];

            $this->load->view('templates/header'$data);
            $this->load->view('suppliers/details'$data);
            $this->load->view('templates/footer');
 
       

My Model
PHP Code:
class Suppliers_model extends CI_Model {

 
       public function __construct()
 
       {
 
           $this->load->database();
 
       }

 
       public function get_suppliers($id FALSE)
 
       {
 
           if ($id === FALSE)
 
           {
 
               //$query = $this->db->get('suppliers');
 
               $query $this->db->query('call read_supplier_list()');
 
               return $query->result_array();
 
           }


 
           $query $this->db->query('call read_supplier(' $id ')');
 
           //$query = $this->db->get_where('suppliers', array('id' => $id));

 
           return $query->row_array();
 
       }

 
       public function get_supplier_certificates($supplier_id)
 
       {
 
           //$query = $this->db->query('call read_supplier_certificates(' . $supplier_id . ')');
 
           $query $this->db->get_where('supplier_certificates', array('supplier_id'$supplier_id));
 
           return $query->result_array();
 
       


So, pleasy tell me where I'm wrong... I dont' get it Sad
Reply


Messages In This Thread
MySQL, Querybuilder, Controller problems... ERR 2014 - by cyrus - 03-19-2017, 04:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB