2013-01-18 115 views
-1

这听起来有点含糊,但我正在寻找一个来自MySQL数据库的一行变量。目前看起来像这样:在<img src"xxxxx">里面放置一个MySQL变量<img src"xxxxx">

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>"; 
?> 
+0

http://php.net/manual/en/language.types.string.php#language.types.string.parsing –

+0

我期待打开在显示时将Helo列转换为图像 – Cassette

+1

tables + mysql_query +回显html ...非常棒。 –

回答

3

尝试:

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

这工作绝对完美。谢谢! – Cassette