Take a look at example 2 in the manual. In your first query you can use:
$staff = $select->fetchAll(PDO::FETCH_COLUMN, 0);
And your second array will have the same form as the first array.
More Related Contents:
- Can I bind an array to an IN() condition in a PDO query?
- Is there a way to fetch associative array grouped by the values of a specified column with PDO?
- PDO fetch one column from table into 1-dimensional array
- Using value of a column as index in results using PDO
- PHP/SQL Insert Error when using Named Placeholders
- Perform logic operations on boolean array values
- How to apply bindValue method in LIMIT clause?
- How to Remove Array Element and Then Re-Index Array?
- PHP PDO – Bind table name? [duplicate]
- How to debug PDO database queries?
- PHP: merge two arrays while keeping keys instead of reindexing?
- How to check if an array value exists?
- PDO multiple queries
- multidimensional array array_sum
- Parametrized PDO query and `LIMIT` clause – not working [duplicate]
- Using htmlspecialchars function with PDO prepare and execute
- Dynamic array keys
- Convert a String into an Array of Characters
- How do i count same values in an array and store it to a variable?
- What is the advantage of using try {} catch {} versus if {} else {}
- Remove duplicate items from an array [duplicate]
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- Call to undefined method PDO::execute()
- Chunk and transpose a flat array into rows with a specific number of columns
- What is the max key size for an array in PHP?
- return one value from database with mysql php pdo
- Split array into a specific number of chunks
- How can I pass an array of PDO parameters yet still specify their types?
- Sort a multidimensional array descending by subarray count and preserve first level keys
- Why does PHP not complain when I treat a null value as an array like this?