title: extract array values from a function
body: <p>Below is a function in PHP I created which returns some product information in an array. On the web page where I am calling this function I want to be able to specify exact array elements for example just the product description ($result2['itm_desc']). Please can someone point me in the right direction as to do this. I would assume you call a function like fetch array but i'm not quite sure how to execute this.</p>
  
  <pre><code>public function getAllReelImages(){
  $sql = "SELECT id FROM $this-&gt;table3 WHERE itm_cat = 2 ORDER BY id ASC";
  echo "&lt;br /&gt;&lt;br /&gt;";
  $stmt = mysqli_query($this-&gt;connection, $sql);
  
  /*fetch values*/
  
  while($result = mysqli_fetch_array($stmt)){
  echo "&lt;br /&gt;&lt;br /&gt;";
  
  $sql2 = "SELECT itm_details.id,itm_details.itm_make,itm_details.itm_model,itm_details.itm_desc,itm_pic_detail.itm_pic_name, itm_value.itm_sale_price 
  FROM 
  itm_details, itm_pic_detail, itm_value 
  WHERE 
  itm_details.id = {$result['id']} AND itm_pic_detail.id = {$result['id']} 
  AND itm_value.id = {$result['id']} ORDER BY id ASC"; 
  
  $stmt2 = mysqli_query($this-&gt;connection, $sql2);
  while($result2 = $stmt2-&gt;fetch_array()){
  echo ($result2['id']); echo"&lt;br /&gt;";
  echo ($result2['itm_make']); echo"&lt;br /&gt;";
  echo ($result2['itm_model']); echo"&lt;br /&gt;";
  echo ($result2['itm_desc']); echo"&lt;br /&gt;";
  echo ($result2['itm_sale_price']); echo"&lt;br /&gt;";
  echo "&lt;img src='$this-&gt;dir"."{$result2['itm_pic_name']}'&gt;&lt;br /&gt;";
  echo"&lt;br /&gt;";
  echo $value; 
  }
  }
  }
  </code></pre>