View Single Post
  #2 (permalink)  
Old 12-17-2008, 08:28 AM
DaveSawers's Avatar
DaveSawers DaveSawers is offline
WebProWorld Veteran
WebProWorld MVP
 
Join Date: Dec 2006
Location: Bragg Creek, AB, Canada
Posts: 533
DaveSawers RepRank 4DaveSawers RepRank 4DaveSawers RepRank 4
Default Re: How to show default picture?

Code:
<?php

$query1="SELECT `item`,`picture`,`code` FROM `Gallery` where `active` ='1' order by `item` DESC LIMIT 5";
$result1 = mysql_query($query1);

$num_rows = mysql_num_rows($result1);
for($i = 0; $i < $num_rows; $i++) {
 $row = mysql_fetch_array($result1);
 $product=mysql_result($result1,$i,"item");
 $photoid=mysql_result($result1,$i,"picture");
 $ext=mysql_result($result1,$i,"code");

 if (file_exists('$siteurl/photo/$photoid.$ext')) {
   echo "Product: <img src='$siteurl/photo/$photoid.$ext'><a href='$siteurl/$product.html'><font color=Red>$product</font></a><br />";
 } else {
   echo "Product: <img src='$siteurl/nophoto/emptypic.jpg'><a href='$siteurl/$product.html'><font color=Red>$product</font></a><br />";
 }
}
?>
__________________
Dynamic Software Development
www.activeminds.ca

Last edited by DaveSawers; 12-17-2008 at 08:31 AM.
Reply With Quote