|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
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 />";
}
}
?>
Last edited by DaveSawers; 12-17-2008 at 09:31 AM. |
|
||||
|
Hi DaveSawers
Tried your solution but it simply shows emptypic.jpg for all even though there are 2 other photos. The 'code' is actually extension code for photos - i.e. jpg, gif or png. If no photo then the 'code' will be NULL. Any method to use the 'code' for NULL to display the emptypic.jpg instead? Thanks! |
|
||||
|
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 />";
Code:
} else {
echo "Product: <img src='$siteurl/nophoto/emptypic.jpg'><a href='$siteurl/$product.html'><font color=Red>$product</font></a><br />";
}
Any suggestion is greatly appreciated. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Picture from Cratima - I do have a picture! | Cratima | Member Photos | 3 | 07-31-2006 03:31 AM |
| PR 5 - flash slide show and photo slide show related | lookaa | Link Exchange | 2 | 03-22-2006 08:16 AM |
| IIS 5.0 and default log properties | ADAM Web Design | IT Discussion Forum | 2 | 11-07-2005 11:28 AM |
| Replace MSN as default on my pc | Rats | MSN Search Discussion Forum | 5 | 11-13-2004 07:09 AM |
| Only want picture to show at night. | wbsweb | Graphics & Design Discussion Forum | 9 | 11-09-2003 12:15 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |