悬停文本仅显示第一个单词

I am trying to display popup text when I hover over some other text. The popup text will only display the first word. I am rather new to php and such, so I hope this is not an idiotic question, but what am I doing wrong here?

while ($row = mysql_fetch_array($data)) {
    $description = $row[2];
    echo $description;  //output:  "Get an Automatic..."
    echo "<a title=$description>";  //Hover output:  "Get"
    echo "blah blah blah";
    echo "</a>;
}

You need to wrap them with quotes:

echo "<a title='$description'>"

Sidenote: It's also important that you might get strings like this:

Get an automatic test's

That will surely mess up that quoting, and terminate it early, might be better to add htmlspecialchars() in that case:

$description = htmlspecialchars($row[2], ENT_QUOTES);

This should work for you:

while ($row = mysql_fetch_array($data)) {
    $description = $row[2];
    echo $description;  //output:  "Get an Automatic..."
    $firstWord = explode(' ',trim($description));
    echo "<a title='$firstWord[0]'>";  //Hover output:  "Get"
    echo "blah blah blah";
    echo "</a>";
}

BTW: you have to warp the string in the title attribut and you forgot a " quote at the end

UPDATE after comment:

Yes that could be because you didn't warp the title attribute and you forgot a " quote at the end

So change it to this:

...
echo "<a title='$description'>";
...
echo "</a>";