What is the most simple way to fetch a list of elements using PHP PDO? There are so many fetch and fetch parameters that I'm not sure which is the right one.
Table Users
| id | username | age |
-----------------------
| 5 | Joey | 33 |
| 6 | Terry | 44 |
| 7 | Billy | 44 |
Query
$q = "SELECT username FROM Users WHERE age = 44";
$db->prepare($q)->execute();
$res = $db->fetch??(PDO::??);
echo json_encode($res);
// Should return, ideally, {"Terry", "Billy"}
If I use fetchColumn I seem to just get one result. If I use fetchAll with assoc_array, well I don't want to iterate over the array if I can avoid it.