How can I change this foreach statement so that it will build an array with all the rows in the particular column? It's currently only adding the last row in column 'first_name' to the array.
try {
$stmt = $conn->prepare("SELECT * FROM student");
$stmt->execute();
} catch(PDOException $e) {
echo $e->getMessage();
}
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$first_names = array();
foreach ($rows as $row) {
$first_names = $row['first_name'];
}