title: PDO fetch one column from table into 1-dimensional array
body: <p>I'm fairly new to PDO and getting them to work with MySQL. I seem to be getting on alright with inserting new data and retriving single results however this I am stuck with.</p>
  
  <p>I have a table that is made up of ingredients, I'm trying to make all the ingredients into a single array.</p>
  
  <p>I've run the query directly into SQL and it shows me all the results, yet with PDO I can not get this with the just a <code>fetch</code>. When I use the <code>fetchAll</code> approach as below it gives me all the results but in a multidimensional array rather than just an array.</p>
  
  <p>Is there a seperate <code>fetch</code> method or do I have to create a loop which adds the results into <code>$a[]</code>?</p>
  
  <pre><code>$ingredient_q = "SELECT
          `ingredient_name`
           FROM
              `ingredients`
          ";
  
  $ingredient_stmt = $pdo-&gt;query($ingredient_q);
  
  $ingredient_stmt -&gt;setFetchMode(PDO::FETCH_ASSOC);
  
  $a = $ingredient_stmt-&gt;fetchAll();
  </code></pre>
  
  <p>Things I've tried:</p>
  
  <pre><code>$a = $ingredient_stmt-&gt;fetchAll(); // Returns a multidimensional array (not what I want)
  $a = $ingredient_stmt-&gt;fetch(); // Returns one single result (the first entry)
  $a[] = $ingredient_stmt-&gt;fetch(); // Returns one single result but in a multidimensional array.
  </code></pre>
  
  <p>Any help will be greatly appreciated.</p>