将MySQL变量放在<img src"xxxxx"=""/>内

时间:2013-01-18 23:13:40

标签: php html mysql

这可能听起来有点模糊,但我希望将一个来自MySQL数据库的变量放在一行HTML中。目前它看起来像这样:

hi

以下是我正在使用的代码。 谢谢!

echo "<table border='1'>";
echo "<tr> <th>Helo</th> <th>Class</th> <th>Need</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['Icon'];
    echo "</td><td>"; 
    echo $row['Class'];
    echo "</td><td>"; 
    echo $row['Need'];
    echo "</td></tr>"; 
} 

echo "</table>";
?>

1 个答案:

答案 0 :(得分:3)

尝试:

echo '<img src="'.$row['Helo'].'" title="'.$row['Class'].'">';