title: Codeigniter Getting error on both array notation and object notation
body: <p>I am using codeigniter for my project and couldn't find what's wrong with my code. This is my controller code</p>
  
  <pre><code>$products = $this-&gt;products_model-&gt;getProductsQuantity($id);
  $q = $warehouse_product-&gt;quantity;
  </code></pre>
  
  <p><strong>object notation</strong> is working but getting error: <strong>Trying to get property of non-object</strong> </p>
  
  <pre><code>$q = $warehouse_product['quantity'];
  </code></pre>
  
  <p><strong>array notation</strong> not working and getting php error: <strong>Fatal error: Cannot use object of type stdClass as array in products\controllers\products.php on line xx</strong></p>
  
  <p>Here is my model function</p>
  
  <pre><code>public function getProductsQuantity($product_id) 
      {
          $q = $this-&gt;db-&gt;get_where('products', array('product_id' =&gt; $product_id), 1); 
            if( $q-&gt;num_rows() &gt; 0 )
            {
              return $q-&gt;row();
            } 
  
            return FALSE;
  
  }
  </code></pre>
  
  <p>Please help me to fins where is the problem in my code.</p>