PHP - PDO获取循环

I think I'm losing my mind here.

This is the code. (It's a simplified version of what I am actually trying to do in order to demonstrate the point.)

$STH = $DBH->query("SELECT * FROM help");
$STH->setFetchMode(PDO::FETCH_ASSOC);

while($row = $STH->fetch()) {
    echo $row['text'];
    $help_text = $row['text'];
}
echo "->";
echo $help_text;
echo "<-";

The db connection to the MySQL db using the handle DBH is fine (not listed). The query works fine. The echo of $row['text'] within the loop works fine multiple times. However, the echo of $help_text between -> and <- does nothing, resulting in -><- being displayed. I would expect the echo to show the last instance of $row['text'].

Why is this not working, please?!

You need to declare it outside the loop

$help_text = "";
while($row = $STH->fetch()) {
    echo $row['text'];
    $help_text .= $row['text'];
}
echo "->";
echo $help_text;
echo "<-";