我最近開始學習Javascript,但仍然沒有在這個問題上的專家。
所以我想知道是否有人云幫助我。如何在php無法從服務器提取圖像時顯示圖像?
我使用MySQL數據庫和PHP
我的數據庫表構建投資組合的網站有3個冒號:name, small_image, description
。
我已經設置了我的PHP,以便它提取name
和small_image
。
$name = htmlentities($row['name']);
$image_small = "images/" . $row['image_small'];
,並將它顯示是這樣的:
$name
< img src='$image_small' with='$width' height='$height' />
我唯一的問題是,當我進入管理頁面,添加了新的工作,在網站上沒有圖像出現一個空的空間。
我想要做的是有一個圖像,可以取代失蹤的圖像?
有沒有辦法讓它工作?或者更好,簡單的方法來做到這一點?
我真的很感激它。
這裏不工作是完整的代碼。
< - - - - - - - - - - - - - - - - - - - - 全碼 - - - - - - - - - - - - - - - - >
// Loop through all of the records returned from the query
while($row = mysql_fetch_array($results)) {
// collect data from each field
$id = $row['id'];
$name = htmlentities($row['name']);
$desc_short = htmlentities($row['desc_short']);
if(isset($row['image_small'])){
$image_small = "images/jewelry/small/" . $row['image_small'];
}
else{
$image_small = "images/blank.jpg";
}
echo "
<li class='column_$x $last_row_class'>
<a href='details.php?id=$id'>
<img src='$image_small' with='$width' height='$height' />
</a>
<p class='product_name'><a href='details.php?id=$id'>$name</a></p>
<p class='product_desc'>$desc_short</p>
$rating_div
</li>";
你把blank.jpg圖像放在圖像文件夾? – 2011-06-03 05:28:43