Link to home
Start Free TrialLog in
Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan

asked on

add full path to filename from MySQL database

I am setting up an image gallery using MySQL and PHP to store the image file names.

It's for a real estate website and my client adds a different amount of images per property.

I am using the default dreamweaver image swap behaviour

On the webspage i am calling these images using:
 
images/small/<?php echo$row_Recordset1['mainimage']; ?>
images/small/<?php echo$row_Recordset1['additionalimage1']; ?>
images/small/<?php echo$row_Recordset1['additionalimage2']; ?>
images/small/<?php echo$row_Recordset1['additionalimage3']; ?> etc

The thing is, when my client only for example adds 2 images a red cross appears for the third as there is no third image.

Is there a way around this?

<?php require_once('Connections/Raglan.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$displayarray = array(
"F"=>"Asking price of",
"I"=>"Offers in the region of",
"O"=>"Offers in excess of",
"A"=>"Auction guide price of",
"S"=>"Subject to contract",
"R"=>"Price range of",
"B"=>"Prices from",
"G"=>"Guide price",
"P"=>"Price on application",
"W"=>"Weekly rental of",
"M"=>"Monthly rental of",
"N"=>"Annual rental of",
 
);
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
  $colname_Recordset1 = $_GET['id'];
}
mysql_select_db($database_Raglan, $Raglan);
$query_Recordset1 = sprintf("SELECT propertyID, additionalimage1, additionalimage2, additionalimage3, additionalimage4, additionalimage5, additionalimage6, additionalimage7, additionalimage8, additionalimage9, additionalimage10, additionalkeywords, address, agentBranch, agentGroup, bathrooms, bedrooms, brochure, contactEmail, contactName, contactTelephone, countryCode, createdDate, details, EERCurrent, EERImage, EERPotential, EIRCurrent, EIRImage, EIRPotential, epcbutton, EPCDocument, exportDate, floorPlan1, floorPlan2, floorPlan3, floorplan4, fullPostCode, furnished, groundRent, HIPDocument, leaseholdYearsRemaining, mainimage, `mode`, modifiedDate, name, newHome, notes, FORMAT(prices,2) as prices, priceCurrency, pricePrefix, propertyType, receptionRooms, regionCode, rentalLength, saleOrRent, sellingState, serviceCharge, sharedCommision, summary, tenure, vTourURL, vTour2URL, fullPath, planbutton, google, area, FORMAT(prices2,2) as prices2, pricePrefix2, `currency` FROM properties WHERE propertyID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $Raglan) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Raglan | Sales | Lettings | Property Management | International</title>
<link href="raglan.css" rel="stylesheet" type="text/css" />
 
<SCRIPT LANGUAGE="JavaScript">
 
img1 = new Image();
img1.src = "images/large/<?php echo$row_Recordset1['additionalimage1']; ?>";
 
img2 = new Image();
img2.src = "images/large/<?php echo$row_Recordset1['additionalimage2']; ?>";
 
img3 = new Image();
img3.src = "images/large/<?php echo$row_Recordset1['additionalimage1']; ?>";
 
img4 = new Image();
img4.src = "images/large/<?php echo$row_Recordset1['additionalimage2']; ?>";
 
img5 = new Image();
img5.src = "images/large/<?php echo$row_Recordset1['additionalimage1']; ?>";
 
img6 = new Image();
img6.src = "images/large/<?php echo$row_Recordset1['additionalimage2']; ?>";
 
img7 = new Image();
img7.src = "images/large/<?php echo$row_Recordset1['additionalimage1']; ?>";
 
img8 = new Image();
img8.src = "images/large/<?php echo$row_Recordset1['additionalimage2']; ?>";
 
</script>
 
<script type="text/javascript">
 
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openChromeslessWindow(openUrl, winName, wWidth, wHeight, wPosx, wPosy, wTIT,
												windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel,
													bCenter, sFontFamily, sFontSize, sFontColor){
	
	openchromeless(openUrl,winName, wWidth, wHeight, wPosx, wPosy, wTIT, wTIT ,
							windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel,
								bCenter, sFontFamily, sFontSize, sFontColor);
}
//-->
</script>
 
 
 
</head>
 
<body onload="MM_preloadImages('images/but-sales-ovr.jpg','images/but-lettings-ovr.jpg','images/but-commercial-ovr.jpg','images/but-int-ovr.jpg','images/but-prop-ovr.jpg','images/but-news-ovr.jpg','images/but-cont-ovr.jpg','images/but-news.jpg','images/large/<?php echo$row_Recordset1['additionalimage2']; ?>','images/large/<?php echo$row_Recordset1['additionalimage4']; ?>','images/large/<?php echo$row_Recordset1['additionalimage5']; ?>','images/large/<?php echo$row_Recordset1['additionalimage11']; ?>','images/large/<?php echo$row_Recordset1['additionalimage1']; ?>')">
<table height="245" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  <tr>
    <td valign="top"><table width="400" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="55" align="left"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/but-home-ovr.jpg',0)"><img src="images/but-home.jpg" alt="Raglan Home" name="Image1" width="55" height="37" border="0" id="Image1" /></a></td>
        <td width="51" align="left"><a href="sales.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/but-sales-ovr.jpg',1)"><img src="images/but-sales.jpg" alt="Raglan Property Sales" name="Image2" width="51" height="37" border="0" id="Image2" /></a></td>
        <td width="71" align="left"><a href="letting.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/but-lettings-ovr.jpg',1)"><img src="images/but-lettings.jpg" alt="Raglan lettings" name="Image3" width="71" height="37" border="0" id="Image3" /></a></td>
        <td width="43" align="left"><a href="commercial.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/but-commercial-ovr.jpg',1)"><img src="images/but-commercial.jpg" alt="Raglan Commercial Property" name="Image4" width="92" height="37" border="0" id="Image4" /></a></td>
        <td width="33" align="left"><a href="international.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/but-int-ovr.jpg',1)"><img src="images/but-int.jpg" alt="Raglan International Property" name="Image5" width="111" height="37" border="0" id="Image5" /></a></td>
        <td width="33" align="left"><a href="property.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/but-prop-ovr.jpg',1)"><img src="images/but-prop.jpg" alt="Raglan Property Management" name="Image6" width="170" height="37" border="0" id="Image6" /></a></td>
        <td width="33" align="left"><a href="news.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','images/but-news-ovr.jpg',1)"><img src="images/but-news.jpg" alt="Raglan Property News" name="Image7" width="115" height="37" border="0" id="Image7" /></a></td>
        <td width="33" align="left"><a href="contact.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','images/but-cont-ovr.jpg',1)"><img src="images/but-cont.jpg" alt="Contact Raglan Property" name="Image8" width="88" height="37" border="0" id="Image8" /></a></td>
        <td width="48"><img src="images/tel.jpg" width="227" height="37" alt="Raglan Property Telephone" /></td>
      </tr>
    </table>
      <table width="980" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="756" rowspan="2" valign="top" bgcolor="#FFFFFF"><table width="745" border="0" cellspacing="0" cellpadding="18">
            <tr>
              <td><span class="copyblueCopy"><img src="images/Rag-final.jpg" width="180" height="124" alt="property lettings" /><br />
                <img src="images/propertydetails.jpg" width="180" height="31" alt="property lettings" /></span></td>
            </tr>
            <tr>
              <td valign="top"><table width="714" border="0" cellpadding="0" cellspacing="0" class="detailbox">
                <tr>
                  <td width="300" rowspan="2" valign="top"><table width="279" border="0" cellspacing="0" cellpadding="10">
                    <tr>
                      <td width="259" valign="top" class="copy"><p><span class="blacktitle"><br />
                        <?php echo $row_Recordset1['name']; ?></span><br />
                        <br />
                        <span class="copyblue"><?php echo $displayarray[$row_Recordset1['pricePrefix']]; ?> </span><span class="copyblueCopy">£<?php echo $row_Recordset1['prices']; ?></span> <br />
                        <span class="copyblue"><?php echo $displayarray[$row_Recordset1['pricePrefix2']]; ?></span> <span class="copyblueCopy"><?php echo $row_Recordset1['currency']; ?><?php echo $row_Recordset1['prices2']; ?></span></span>                          <br />
                          <br />
                          <span class="copybold">Address</span><br />
                          <?php echo $row_Recordset1['address']; ?><br />
                          <br />
                          <span class="copybold">Property Details</span><br />
                          <?php echo nl2br($row_Recordset1['details']); ?><br />
                          <br />
                          <a href="http://www.raglaninternational.com/images/large/<?php echo nl2br($row_Recordset1['floorPlan1']); ?>"><img src="images/<?php echo nl2br($row_Recordset1['planbutton']); ?>" alt="" border="0" /></a><br />
                          <a href="http://www.raglaninternational.com/images/large/<?php echo nl2br($row_Recordset1['EPCDocument']); ?>"><img src="images/<?php echo nl2br($row_Recordset1['epcbutton']); ?>" alt="" border="0" /></a><br />
                          <span class="copybold">Please contact us for more details</span><br />
                          If you would like more information regarding this property please call us on +44 (0)20 3355 9321 or <a href="mailto:info@raglaninternational.com?subject=<?php echo$row_Recordset1['name']; ?>">email us</a><br />
                        </p></td>
                      </tr>
                    </table></td>
                  <td width="410" height="105" align="right" valign="top" bgcolor="#FFFFFF"><table width="400" border="0" cellpadding="0" cellspacing="0" class="hello">
                    <tr>
                      <td align="center" valign="top" bgcolor="#FFFFFF"><img src="images/large/<?php echo$row_Recordset1['mainimage']; ?>" name="main" width="" height="" class="gapbelow" id="main" /></td>
                      </tr>
                    <tr>
                      <td align="center" bgcolor="#FFFFFF"><img src="images/small/<?php echo$row_Recordset1['mainimage']; ?>" alt="" name="img1" class="thumbgapright" id="img13" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['mainimage']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage1']; ?>" name="img1" class="thumbgapright" id="img1" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage1']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage2']; ?>" alt="" name="img2" class="thumbgapright" id="img2" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage2']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage3']; ?>" alt="" name="img2" class="thumbgapright" id="img3" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage3']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage4']; ?>" alt="" name="img2" class="thumbgapright" id="img4" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage4']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage5']; ?>" alt="" name="img2" class="thumbgapright" id="img5" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage5']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage6']; ?>" alt="" name="img2" class="thumbgapright" id="img6" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage6']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage7']; ?>" alt="" name="img2" class="thumbgapright" id="img7" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage7']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage8']; ?>" alt="" name="img2" class="thumbgapright" id="img8" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage8']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage9']; ?>" alt="" name="img2" class="thumbgapright" id="img9" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage9']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage10']; ?>" alt="" name="img2" class="thumbgapright" id="img10" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage10']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage11']; ?>" alt="" name="img2" class="thumbgapright" id="img11" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage11']; ?>',1)" /><img src="images/small/<?php echo$row_Recordset1['additionalimage12']; ?>" alt="" name="img2" class="thumbgapright" id="img12" onclick="MM_swapImage('main','','images/large/<?php echo$row_Recordset1['additionalimage12']; ?>',1)" /></td>
                      </tr>
                    </table></td>
                  </tr>
                <tr>
                  <td align="right" valign="top"><table width="400" border="0" cellpadding="0" cellspacing="0" class="topgap">
                    <tr>
                      <td><?php echo$row_Recordset1['google']; ?></td>
                    </tr>
                  </table></td>
                  </tr>
                </table></td>
            </tr>
          </table></td>
          <td width="224" align="right" valign="top" bgcolor="#FFFFFF"><table width="222" border="0" cellpadding="0" cellspacing="0" class="search">
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="271" align="center" valign="top"><table width="216" border="0" cellpadding="10" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" action="SearchResults.php" method="get">
                    <table width="200" border="0" cellpadding="8" cellspacing="1">
                      <tr>
                        <td bgcolor="#F6F6F6"><span class="copybold">I want to:</span><br />
                          <table width="175" height="18" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="58" valign="top"><input name="type" type="radio" class="radiogap" id="saleOrRent" value="Sales" checked="checked" />
                                <span class="copy">Buy </span><br />
                                <select name="min2" class="copy" id="min2">
                                  <option value="0">£ buy minimum</option>
                                  <option value="75000">75,000</option>
                                  <option value="100000">100,000</option>
                                  <option value="150000">150,000</option>
                                  <option value="200000">200,000</option>
                                  <option value="400000">400,000</option>
                                  <option value="500000">500,000</option>
                                  <option value="600000">600,000</option>
                                  <option value="700000">700,000</option>
                                  <option value="800000">800,000</option>
                                  <option value="900000">900,000</option>
                                  <option value="1000000">1,000,000</option>
                                  <option value="1250000">1,250,000</option>
                                  <option value="1500000">1,500,000</option>
                                  <option value="2000000">2,000,000</option>
                                  <option value="3000000">3,000,000</option>
                                </select>
                                <select name="max2" class="copy" id="max2">
                                  <option value="1000000000">£ buy maximum</option>
                                  <option value="75000">75,000</option>
                                  <option value="100000">100,000</option>
                                  <option value="150000">150,000</option>
                                  <option value="200000">200,000</option>
                                  <option value="400000">400,000</option>
                                  <option value="500000">500,000</option>
                                  <option value="600000">600,000</option>
                                  <option value="700000">700,000</option>
                                  <option value="800000">800,000</option>
                                  <option value="900000">900,000</option>
                                  <option value="1000000">1,000,000</option>
                                  <option value="1250000">1,250,000</option>
                                  <option value="1500000">1,500,000</option>
                                  <option value="2000000">2,000,000</option>
                                  <option value="3000000">3,000,000</option>
                                </select></td>
                            </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td bgcolor="#F6F6F6"><table width="174" height="18" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="58" valign="top"><span class="copy">
                              <input name="type" type="radio" class="radiogap" id="saleOrRent2" value="rent" />
                              Rent <br />
                              <select name="min" class="copy" id="min">
                                <option value="0">£ rental minimum</option>
                                <option value="100">£100 per week</option>
                                <option value="250">£250 per week</option>
                                <option value="400">£400 per week</option>
                                <option value="500">£500 per week</option>
                                <option value="600">£600 per week</option>
                                <option value="750">£750 per week</option>
                                <option value="1000">£1000 per week</option>
                                <option value="1500">£1500 per week</option>
                                <option value="2000">£2000 per week</option>
                              </select>
                              <select name="max" class="copy" id="max">
                                <option value="100000000">£ rental maximum</option>
                                <option value="100">£100 per week</option>
                                <option value="250">£250 per week</option>
                                <option value="400">£400 per week</option>
                                <option value="500">£500 per week</option>
                                <option value="600">£600 per week</option>
                                <option value="750">£750 per week</option>
                                <option value="1000">£1000 per week</option>
                                <option value="1500">£1500 per week</option>
                                <option value="2000">£2000 per week</option>
                              </select>
                            </span></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td bgcolor="#F6F6F6"><span class="copybold">Bedrooms:</span>
                          <select name="bedrooms" class="copy" id="bedrooms">
                            <option value="1" selected="selected">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6+">6+</option>
                          </select></td>
                      </tr>
                      <tr>
                        <td bgcolor="#F6F6F6"><span class="copybold">Area:</span>
                          <select name="area" class="copy" id="area">
                            <option value="London">Premium London</option>
                            <option value="Country">Country</option>
                            <option value="International">International</option>
                          </select></td>
                      </tr>
                      <tr>
                        <td><input name="submit" type="image" id="submit" src="images/search.jpg" alt="Add to Basket" /></td>
                      </tr>
                    </table>
                  </form></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td align="right" valign="top" bgcolor="#FFFFFF"><table width="222" border="0" cellpadding="0" cellspacing="0" class="piclink">
            <tr>
              <td valign="top"><table width="222" border="0" cellpadding="10" cellspacing="0" class="logos">
                <tr>
                  <td align="center"><span class="copy"><img src="images/facebook-logo.jpg" width="160" height="94" alt="DPS logo" /></span></td>
                  </tr>
                <tr>
                  <td align="center"><span class="copy"><img src="images/twitter-logo.jpg" width="160" height="66" alt="DPS logo" /></span></td>
                  </tr>
                <tr>
                  <td><span class="copy"><img src="images/find_a_property.gif" width="196" height="80" alt="DPS logo" /></span></td>
                  </tr>
                <tr>
                  <td align="center"><span class="copy"><img src="images/primelocation-logo.gif" width="95" height="95" alt="DPS logo" /></span></td>
                  </tr>
                <tr>
                  <td align="center"><span class="copy"><img src="images/dps-logo.jpg" width="100" height="54" alt="DPS logo" /></span></td>
                  </tr>
                </table></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td valign="top"><table width="150" border="0" cellpadding="0" cellspacing="0" class="bottombit">
      <tr>
        <td align="center" class="terms" onclick="openChromeslessWindow('terms.html','Terms',800,600,null,null,'Terms', '#000000', '#000000', '#999988', '#808040' ,true,'Verdana, Geneva, sans-serif', '1','#000000')">© Raglan International 2009 |<a href="terms.html" class="web"> terms &amp; conditions</a> | <span class="web"><a href="privacy.html" class="web">Privacy Policy</a></span> |<a href="http://www.brighteyesdesign.co.uk" class="web"> website by brighteyes</a></td>
      </tr>
    </table>      <a href="contact.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','images/but-cont-ovr.jpg',1)"></a></td>
  </tr>
</table>
 
 
</body>
</html>
 
<?php
mysql_free_result($Recordset1);
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of AielloJ
AielloJ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BrighteyesDesign

ASKER

Cheers, a great help, works perfectly!
Where you have line 184 you could replace it with something like the code below.

This should then only output images when there is a non empty string in the corresponding db field.

I haven't test this code so I can't guarntee it'll work "outta the box" so to speak but it should be close.

<td align="center" bgcolor="#FFFFFF">
foreach($row_Recordset1 as $key => $value)
{
    if(stripos($key, 'additionalimage') !== false AND trim($value) != "")
    {
        $img_id = 'img'.substr($key, strlen('additionalimage'));
        $img_name = $value;
        ?>
        <img src="images/small/<?php echo $img_name; ?>" alt="" class="thumbgapright" id="<?php echo $img_id; ?>" onclick="MM_swapImage('main','','images/large/<?php echo $img_name; ?>',1)" /><br />
        <?php
    }
}
?>
                      </td>

Open in new window

lol - must've opened this question just before you accepted the solution :)

Also i see that i'd missed the mainimage so my answer should really be:

<td align="center" bgcolor="#FFFFFF">
foreach($row_Recordset1 as $key => $value)
{
    if((stripos($key, 'additionalimage') !== false OR (stripos($key, 'mainimgage') !== false)) AND trim($value) != "")
    {
        $img_id = 'img'.substr($key, strlen('additionalimage'));
        $img_name = $value;
        ?>
        <img src="images/small/<?php echo $img_name; ?>" alt="" class="thumbgapright" id="<?php echo $img_id; ?>" onclick="MM_swapImage('main','','images/large/<?php echo $img_name; ?>',1)" /><br />
        <?php
    }
}
?>
</td>
cheers mpn 1983!

I'd give points if i could!
Oh good god - excuse the typo:

where i've got:

stripos($key, 'mainimgage')

it should read:

stripos($key, 'mainimage')

Who knows what a "imgage" is???

hth
Matt