title: I am not able to display View properly in codeigniter. Using foreach loop I have been trying
body: <p>Here you can view the <a href="https://i.stack.imgur.com/ZcApq.png" rel="nofollow noreferrer">output</a></p>
  <p>Here is my controller:-</p>
  <pre><code>public function order_info()
  {
      $this-&gt;load-&gt;model('customize_model');
     $data['user'] = $this-&gt;customize_model-&gt;order_info();
     $data['product']=$this-&gt;customize_model-&gt;order_info();
     $data['sale'] = $this-&gt;customize_model-&gt;order_info();
      $this-&gt;load-&gt;view('custom/order',$data);
  }
  </code></pre>
  <p>And here is my modal:-</p>
  <pre><code> public function order_info()
    {
     $query = $this-&gt;db-&gt;query(&quot;SELECT *
      FROM user
      JOIN product
      ON user.user_id = product.product_id 
      JOIN sale
      ON user.user_id = sale.buyer
      ORDER BY user_id DESC LIMIT 100;&quot;);   
      return $query;
   }
  </code></pre>
  <p>This is view:-</p>
  <pre><code>&lt;?php foreach($sale-&gt;result() as $row)
     {
        $order_id = $row-&gt;sale_id;                                 
        $grand_total = $row-&gt;grand_total;
        $status = $row-&gt;status;
    ?&gt;
        &lt;tr&gt;     
           &lt;td&gt;&lt;?php echo $order_id;?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $username;?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $productname?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $grand_total;?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $status;?&gt;&lt;/td&gt;     
         &lt;/tr&gt; 
         &lt;?php 
           foreach($user-&gt;result() as $row1)
           {
            $username = $row1-&gt;username;  
            foreach($product-&gt;result() as $row2)
            {
              $productname = $row2-&gt;title;                                  
             }
            }
          }
   ?&gt;   
  </code></pre>
  <p>Here in my view I got stuck with displaying records, in single table.
  problem is in view. foreach loop doesn't work in this format which shall i use to solve it.</p>