下面的代碼是我的PHP腳本的一部分,它應該在產品信息前顯示產品圖像。使用PHP插入圖像
每個圖像均標記爲product_id
。那些自動增加並從MySQL數據庫接收的ID。
PHP代碼:
while($row=mysql_fetch_array($result)){
$ProductName = $row['product_name'];
$ProductCat = $row['product_cat'];
$Email = $row['email'];
$ID = $row['product_id'];
//-display the result of the array
echo '<div ><img align="right" src="/project_images/$ID.JPG" width="280" height="125" /></div>';
的圖像顯示爲已損壞的瀏覽器。
是因爲圖像大小錯誤(可能太大)或代碼錯誤?
當您直接從地址欄打開圖像的URL會發生什麼? –
你可以檢查元素(布朗)和寫結果? – Anri
是的,只是圖像損壞 –