title: Pass Value From Controller to Model CodeIginter Using Stored Procedure
body: <p>I have a problem with Codeigniter. I try to pass value from view to controller and it works. But there is a problem when it passing from controller to model. It didn't return any value into View.</p>
  
  <p>Here is my controller:</p>
  
  <pre><code> public function Edit2G() {
                  $id = $this-&gt;uri-&gt;segment(3);
                  $this-&gt;load-&gt;model("main_model");
                  $data['fetch_data_2G_where'] = $this-&gt;main_model-&gt;fetch_data_2G_id($id);
                  $data['id'] = $id;
                  $data['title'] = "Update Data 2G";
  
                  $this-&gt;load-&gt;view('templates/header');
                  $this-&gt;load-&gt;view("pages/Update2G", $data);
                  $this-&gt;load-&gt;view('templates/footer');
              }
  </code></pre>
  
  <p>Here is Model</p>
  
  <pre><code> function fetch_data_2G_id($id)
       {
           $get_2G_data_stored_proc = "CALL Get_2G_Data(?)";
           $data = array( 'id' =&gt;$id);
           $query = $this-&gt;db-&gt;query($get_2G_data_stored_proc, $data);
           $result = $query-&gt;result_array();
           return $get_2G_data_stored_proc;
       }
  </code></pre>
  
  <p>And this is my View</p>
  
  <pre><code>&lt;h2 align="center"&gt;&lt;?=$title ?&gt;&lt;/h2&gt;
  &lt;h3 align="center"&gt;&lt;?=$id ?&gt;&lt;/h3&gt;
  &lt;p align="center"&gt;&lt;?php echo $fetch_data_2G_where['id'];?&gt;&lt;/p&gt; //This is a test
  &lt;?php echo form_open('posts/update'); ?&gt;
  &lt;input type="hidden" name="id" value="&lt;?php //echo $fetch_data_2G_where['id']; ?&gt;"&gt;
  &lt;div class="form-group"&gt;
      &lt;label&gt;Site ID&lt;/label&gt;
      &lt;input type="text" class="form-control" name="title" placeholder="add title" value="&lt;?php //echo $fetch_data_2G_where['site_name'];?&gt;"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the stored procedure result</p>
  
  <pre><code>id, id_site, site_name, bsc_name, bcf_id, vlan1, vlan2, status,status_vlan  
  
  '1', 'COK008', 'Combat Batylon754','FBTIMIKA-1','BCF-0112', '3677', '3137', '', 'Metro E'
  </code></pre>
  
  <p>This in Error That I got</p>
  
  <blockquote>
    <p>A PHP Error was encountered Severity: Warning</p>
    
    <p>Message: Illegal string offset 'id'</p>
    
    <p>Filename: pages/Update2G.php</p>
    
    <p>Line Number: 3</p>
    
    <p>Backtrace:</p>
    
    <p>File: C:\xampp\htdocs\DapotTimika\application\views\pages\Update2G.php
    Line: 3 Function: _error_handler</p>
    
    <p>File: C:\xampp\htdocs\DapotTimika\application\controllers\Pages.php
    Line: 46 Function: view</p>
    
    <p>File: C:\xampp\htdocs\DapotTimika\index.php Line: 315 Function:
    require_once</p>
  </blockquote>
  
  <p>What I am missing?</p>
  
  <p>PS: the stored procedure only has one parameter (id) to return / get data</p>