title: foreach loop array sql query
body: <p>I'm trying to select values from my database when the value != 0 but all I get is an empty array.</p>
  
  <p>Here I've got an array with all the names who are also in the database.</p>
  
  <pre><code>$array  = ['helm' , 'weapon', 'amulet', 'body', 'legs', "boots", 'shield', 'gloves', 'cape'];
  </code></pre>
  
  <p>then I place the array in a foreach loop and place the <code>_name</code> and <code>_value</code> behind the name (in the database it is <code>helm_name = blabla</code> <code>_helm value = 10</code> )</p>
  
  <p>When the text is placed behind the word I loop through it in my <code>query</code> in which I try to select the <code>name table (for example helm_name</code>) and the <code>value table (for example helm_value)</code> </p>
  
  <pre><code>foreach($array as $array_item){
      $array_item_name = $array_item.'_name';
      $array_item_value = $array_item.'_value';
  
      $sql = $db-&gt;prepare("SELECT ".$array_item_name." FROM player WHERE naam = :naam AND ".$array_item_value." != 0");
      $sql-&gt;execute(array(":naam" =&gt; $naam));
      $fetch = $sql-&gt;fetchAll(PDO::FETCH_ASSOC);
  }
  </code></pre>
  
  <p>but all it returns when I run it is <code>Array ( )</code>  what am I doing wrong?</p>