這是我的源代碼。我無法顯示圖片
<?php
include "koneksi.php";
$datatamu= mysql_query("select judul_gambar,nama_file from gambar order by judul_gambar asc");
echo "
<table>
<tr>
<th>judul_gambar</th>
<th>gambar</th>
</tr>";
while($rec=mysql_fetch_object($datatamu)){
echo "<tr>";
echo "<td>".$rec->judul_gambar."</td>";
echo "<td";
echo "<img src='.$rec->nama_file.' alt='.$rec->judul_gambar' title='.$rec->judul_gambar' width='100'>";
echo "</td>";
echo "</tr>";
}"
</table>";
mysql_close();
?>
我創建與源代碼相同的目錄下的一個文件夾。圖片。 這裏是數據庫
id_gambar:INT [5]
judul_gambar:VARCHAR [25]
nama_file:VARCHAR [25]
對不起,如果我的英語不好。 :)
究竟是什麼問題? –
我無法顯示圖片:) – jarenjarfa
SQL位有問題嗎?可能。這可能是因爲你沒有首先獲得URL。做一個var_dump(object)並查看它是否打印URL。 –