PDO fetchAll array to one dimensional <p>this may be a simple question but am struggling to understand how to solve it. I have a form which allows the user to select either "custom" or "all" staff" to assign to a job.</p> <p>If custom is selected the user selects staff by clicking each checkbox, I then insert these into a jobs table. This produces the array below (3, 1, 10 are the staff IDs)</p> <pre><code>Array ( [0] =&gt; 3 [1] =&gt; 1 [2] =&gt; 10 ) </code></pre> <p>If "all staff" is selected, I first query a select statement to get all the staff ID's from the staff table, and then insert these into the job table the same as above. However this produces the array :</p> <pre><code>Array ( [0] =&gt; Array ( [staffID] =&gt; 1 [0] =&gt; 1 ) [1] =&gt; Array ( [staffID] =&gt; 23 [0] =&gt; 23 ) [2] =&gt; Array ( [staffID] =&gt; 26 [0] =&gt; 26 ) [3] =&gt; Array ( [staffID] =&gt; 29 [0] =&gt; 29 ) ) </code></pre> <p>How can I convert the array above to the first array shown? </p> <p>I'm using the code below to query the database to get all the staff ID's and then inserting them.</p> <pre><code> $select = $db-&gt;prepare("SELECT staffID FROM staff"); if($select-&gt;execute()) { $staff = $select-&gt;fetchAll(); } for($i = 0; $i&lt;count($staff); $i++) { $staffStmt = $db-&gt;prepare("INSERT INTO staffJobs (jobID, userID) VALUES (:jobID, :staffID)"); $staffStmt-&gt;bindParam(':jobID', $jobID, PDO::PARAM_INT); $staffStmt-&gt;bindParam(':staffID', $staff[$i], PDO::PARAM_INT); $staffStmt-&gt;execute(); } </code></pre> <p>The first array inserts fine, however the last array inserts zeros for the staffID.</p> <p>Any suggestions?</p> <p>Thanks =).</p>