How to create multidimensional array based on ID from each row (in same View) Codeigniter
<p>I am new in codeigniter both php, I am beginner. Could anyone help me how to show a data from another table based on ID in each row in same View in codeigniter, i just include a file(that is a form with data from another table) im not sure.. how the method should be.. dont know what to do plz ! thx</p>

<p>CONTROLLER</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>$this-&gt;load-&gt;model('m_work_order');
$this-&gt;load-&gt;model('m_srv_product');

$data['items']     =  $this-&gt;m_work_order-&gt;show_items()-&gt;result();

$id=0; // dont know what to do with this ID
$data1['record']     =  $this-&gt;m_srv_product-&gt;show_data($id)-&gt;result_array();

$data['form'] = $this-&gt;load-&gt;view('work_order/form_file', $data1, TRUE);
$this-&gt;load-&gt;view('work_order/form_input',$data);</code></pre>
</div>
</div>
</p>

<p>MODEL m_work_order</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>function show_items(){

$query  =      "SELECT *
                FROM work_order_items 
                WHERE item_status='0'";
                return $this-&gt;db-&gt;query($query);

}</code></pre>
</div>
</div>
</p>

<p>MODEL m_srv_product</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>function show_data($id)
{


    $query= "SELECT a.srv_pr_id,a.srv_vol,a.srv_n,
            b.srv_name,c.prod_cat_name,c.prod_cat_id
                FROM srv_pr_use as a,service as b, prod_category as c
                WHERE a.srv_id = b.srv_id and 
                a.prod_cat_id = c.prod_cat_id and
                a.srv_id = $id ";
                return $this-&gt;db-&gt;query($query);
}</code></pre>
</div>
</div>
</p>

<p>VIEW</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>foreach ($items as $t){
        
echo "
      &lt;tr&gt;
        &lt;td&gt;$no&lt;/td&gt;
        &lt;td&gt;$kode&lt;/td&gt;
        &lt;td&gt;$t-&gt;item_name&lt;/td&gt;
        &lt;td&gt;$t-&gt;item_qty&lt;/td&gt;
        &lt;td&gt;".$form."&lt;/td&gt;
        &lt;/tr&gt;"
}</code></pre>
</div>
</div>
</p>