title: PDO fetch all doesnt work when using variable
body: <p>I posted my code below, My issue is that when I used the $id variable to grab data from the database only and empty array is returned however when I hard set the value of $id into the execute command as 1 it grabs the data. When $id is echoed the number 1 is shown.</p>
  
  <p><a href="https://i.stack.imgur.com/lNxkz.png" rel="nofollow noreferrer">Image / Description</a></p>
  
  <pre><code>&lt;?php
              $ids = array();
              foreach($_SESSION as $name =&gt; $value){
                  if($name[0] == "c"){
                      $id = $name;
                      $id[0] = '';
                      echo("ID: ".$id." for ".$value." orders. &lt;br&gt;");
                      array_push($ids,$id);
  
                      $userQuery = $db-&gt;prepare("
                          SELECT item_id, item_name, cost, descript, stock
                          FROM items
                          WHERE item_id = :idd
                      ");
  
                      $userQuery-&gt;execute(['idd' =&gt; 1]);
                      $result = $userQuery-&gt;fetchAll();
                      var_dump($result);
                      }
              }
              ?&gt;
  </code></pre>