title: Use Array data in another mysql query using PHP and HTML select option
body: <p>Dears,</p>
  <p>I have a problem with my php code..
  What I am trying to do is to use the array data in a second mysql query to list the available options.</p>
  <p>Explanation:</p>
  <pre><code>$conn = mysqli_connect($dbhost,$dbuser,$dbpass) or sqlerror();
  mysqli_select_db($conn,$dbname);
  $sql = mysqli_query($conn,&quot;SELECT * FROM ADMIN WHERE id='&quot;.$_SESSION[&quot;adminusername&quot;].&quot;'&quot;);
  $isadmin=mysqli_fetch_array($sql);
  $arraydata= $isadmin[&quot;Files&quot;];
  mysqli_close($conn);
  $array3 = explode(',',$arraydata);
  </code></pre>
  <p>Now, The code above give me:
  $arraydata = &quot;26,27,28,29&quot;</p>
  <p>I used $array3 to remove the comma .. then tried foreach as following code should be executed:</p>
  <pre><code>$conn = mysqli_connect($dbhost,$dbuser,$dbpass) or sqlerror();
  mysqli_select_db($conn,$dbname);
  foreach ($array3 as $singleID) {
      $sql=mysqli_query($conn,&quot;SELECT FileID,FileTitle FROM Servers WHERE 
          FileType='CFG' AND FileID='&quot;.$singleID.&quot;'&quot;);
      if(mysqli_num_rows($sql)){
          $select= '&lt;select class=&quot;smallInput&quot; name=&quot;serverfile&quot; tabindex=&quot;6&quot;&gt;';
          while($rs=mysqli_fetch_array($sql)){
              $select.='&lt;option value=&quot;'.$rs['FileID'].'&quot;&gt;'.$rs['FileTitle'].'&lt;/option&gt;';
          }
      }
      $select.='&lt;/select&gt;';
      echo $select;
  }
  </code></pre>
  <p>I was hopping this will show a select options for the items in Array that the condition in the second mysql query match, if array item found show it in the options of select ..</p>
  <p>Anyone can fix this?</p>