title: How to retrieve data exactly from database using left join?
body: <p>Hi everyone I have a problem.</p>
  
  <p>When I input data from database is exactly but when I retrieve all the from database is not the same.?
  This is the <a href="http://prntscr.com/2rq8cg" rel="nofollow">output</a> from database and when I retrieve all the data the output is <a href="http://prntscr.com/2rq8e1" rel="nofollow">this</a></p>
  
  <p>My question is how to output the same on the database...</p>
  
  <p>MY CODES..</p>
  
  <pre><code>$iqry = $mysqli-&gt;prepare("SELECT a.code, a.quantity, b.itemname, b.unitmeasure 
                  FROM table_inventory a LEFT JOIN table_item b ON a.id=b.id");
  
  $iqry-&gt;execute();
  
  $iqry-&gt;bind_result($code,$quantity,$item,$unit);
  $iqry-&gt;store_result();
  
  while ($iqry-&gt;fetch()){
    $result[] = array("code"        =&gt; $code,
                      "quantity"    =&gt; $quantity,
                      "itemname"    =&gt; $item,
                      "unitmeasure" =&gt; $unit);
  }
  
  foreach ($result as $r){
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" .$r['code']. "&lt;/td&gt;";
    echo "&lt;td&gt;" .$r['itemname']. "&lt;/td&gt;";
    echo "&lt;td&gt;" .$r['quantity']. "&lt;/td&gt;";
    echo "&lt;td&gt;" .$r['unitmeasure']. "&lt;/td&gt;";
    echo "&lt;td&gt;&lt;a class='edit' href=''&gt;&lt;img src='img/edit.png'&gt;";
    echo "&lt;td&gt;&lt;a href=\"material-del.php\" class='confirm'&gt;&lt;img src='img/delete.png'&gt;&lt;/a&gt;&lt;/td&gt;";
    echo "&lt;/tr&gt;";
  }
  </code></pre>