title: Pass row_array() to Codeigniter view
body: <p>I have this controller code:</p>
  
  <pre><code>10 $rowArr=$this-&gt;m_model-&gt;getItemData($itemID);
  11 $rowArr=['code'=&gt;'123','desc'=&gt;'456','price'=&gt;'789'];
  12 $this-&gt;load-&gt;view('item_v',$rowArr);
  </code></pre>
  
  <p>In my model I have:</p>
  
  <pre><code>$result=$this-&gt;db
    -&gt;select('code','desc','price')
    -&gt;where('itemID',$itemID)
    -&gt;get('catalog')
    -&gt;row_array();
  return $result; 
  </code></pre>
  
  <p>When I run it I get the expected 123, 456, 789 displayed in the 'code', 'desc' and 'price' columns because the second definition of $rowArr gets sent. But when I comment out line 11, allowing the first (intended) definition to take over - I get undefined variable errors for all three in the view.</p>
  
  <p>In my view I'm using:</p>
  
  <pre><code>&lt;div&gt;
     &lt;?php
          echo "&lt;div&gt;";
          echo "code: ".$code."&lt;br&gt;";
          echo "desc: ".$desc."&lt;br&gt;";
          echo "price: ".$price."&lt;br&gt;";
          echo "&lt;/div&gt;";
     ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Since it works OK using the literal array I know the problem must be in the model - no doubt where I attempt to create an array from the db query object. The CI docs seem clear that using the row_array() method should turn the db object into a php array for me. I've tried every variation I could find or think of but nothing works. Can anyone tell me what mistake I'm making? Thanks in advance.</p>