title: Retrieving the data from an sql statement
body: <p>I have written this code which in theory i want to loop round an array and for every value use in a select statement to retrieve the applicable information. Then map a particular value id as a key and the value from the sql statement as its associated value. Though i cant seem to figure out how to add it as a value into my array im sure im a word out.</p>
  
  <p>heres my code</p>
  
  <pre><code>    /*
       * Loop through the hasNewModelIdInYear and retrieve the exterior media paths
       * with a mapped id as a key.
       */
  
       $mediapatharray = array();
  
       foreach ($hasNewModelIdInYear as $key =&gt; $value) {
  
       $selectMediaPathFromValue = "SELECT `name` FROM `media` WHERE `id`='".$value['img1_media_id']."'";
  
       $res = $mysqli-&gt;query($selectMediaPathFromValue);
  
  
          $mediapatharray[$value['model_id']] = $res;
      }
  </code></pre>
  
  <p>All that array returns is an array full of keys but no values.. With the variable $res do i then have to ->fetch_value? as im not sure on the syntax needed in order to access the data from the query?</p>
  
  <p>regards mike</p>