I am looping through a SQL query and I would like to grab that output and save it as a string variable.. is this possible?
My loop is as follows:
foreach ($dbh->query($sql2) as $row2) {
echo $row2['id'];
echo $row2['staff'];
echo $row2['dept'];
}
And I would like to save all of the output as one string variable ie $output
you can append the each coloumn result