Jump to content

Image gallery/Remove image placeholder when no image is available


chotchstar

Recommended Posts

MY CODE IS AT THE BOTTOM OF THE PAGE AND I AM USING phpMyAdmin 2.5.2 MySQL 3.23.56 running

 

Thank you all in advance,

I need to show a default image in the event that a dynamic image does not exist, or blank space would be great. Can anyone help.

 

Also could you let me know how to swap the main image from the thumbnails (click)and rotate the images round please. Simple gallery I guess but dynamic.

 

Kind Regards

 

JC

 

 

require 'listing.inc';

 

    if (array_key_exists("propID", $_GET))

        $propertyID = $_GET["propID"];

    else

        die("Sorry, cannot locate the details for that property");

   

    $query = "SELECT Price, PropertyID, Area, MainDescription, Parking, cFacility1, cFacility2, cFacility3, cFacility4, ";

    $query = $query . "cFacility5, cFacility6, cFacility9, PropertyName FROM listings WHERE PropertyID = '{$propertyID}';";

 

        // Connect to the server

    if (!($connection = @ mysql_connect($hostName, $userName, $password)))

        die("Cannot connect to server {$hostName}");

 

    // print '<div class="debug">Opening database</div>' . "\n";

 

        // Select the database

    if (!(mysql_select_db($databaseName, $connection)))

        showDbError();

 

    // print '<div class="debug">Issuing query</div>' . "\n";

 

    if (!($result = @ mysql_query($query, $connection)))

        showDbError();

 

    if (!($record = @ mysql_fetch_array($result)))

        die("Sorry, cannot locate the details for that property");

 

    $imageFile = "photos/pBRANCH_{$record["PropertyID"]}.jpg";

    $imageFile2 = "photos/bBRANCH_{$record["PropertyID"]}.jpg";

 

 

    print "  <tr>\n";

    print '        <td height="277" width="411">' . "\n";

    print '        <div align="center">' . "\n";

    print "            <img src=\"{$imageFile}\"";

    print ' border="0" height="225" width="340" alt="Property photo" />' . "\n";

    print "            <img src=\"{$imageFile}\"";

    print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";

    print "            <img src=\"{$imageFile2}\"";

    print ' border="0" height="60" width="80" alt="" />' . "\n";

    print "            <img src=\"{$imageFile}\"";

    print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";

    print "            <img src=\"{$imageFile}\"";

    print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";

    print "        </div>    </td>\n";

    print '        <td valign="top" width="389"><p class="style5"><br>' . "\n";

    print '        <span class="style6"><span class="style8">Property</span><span class="style7"><br>Details</span></span>' . "\n";

    print '            <br><br><strong><br>Area:</strong>' . "\n";

    print "{$record["PropertyName"]}<br><strong>Price:</strong><span class=\"style24\"> £{$record["Price"]} PCM</span>\n";

    print "        <br><br></p></td></tr>\n";

    print '  <tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" height="181" width="387">' . "\n";

    print "        <tr>\n";

    print '            <td bgcolor="#547cad" width="44"> </td>' . "\n";

    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">&#8226; ';

    print "{$record["cFacility1"]}</span></td>\n";

    print '            <td bgcolor="#547cad" width="190"><span class="style17">&#8226; ';

    print "{$record["cFacility2"]}</span></td>\n";

    print "        </tr>\n";

    print "        <tr>\n";

    print '            <td bgcolor="#547cad" width="44"> </td>' . "\n";

    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">&#8226; ';

    print "{$record["cFacility3"]}</span></td>\n";

    print '            <td bgcolor="#547cad" width="190"><span class="style17">&#8226; ';

    print "{$record["cFacility4"]}</span></td>\n";

    print "        </tr>\n";

    print "        <tr>\n";

    print '            <td bgcolor="#547cad" width="44"> </td>' . "\n";

    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">&#8226; ';

    print "{$record["cFacility5"]}</span></td>\n";

    print '            <td bgcolor="#547cad" width="190"><span class="style17">&#8226; ';

    print "{$record["cFacility6"]}</span></td>\n";

    print "        </tr>\n";

    print "        <tr>\n";

    print '            <td bgcolor="#547cad" width="44"> </td>' . "\n";

    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">&#8226; ';

    print "{$record["cFacility9"]}</span></td>\n";

    print '            <td bgcolor="#547cad" width="190"><span class="style17">&#8226; PARKING ';

    print "{$record["Parking"]}</span></td>\n";

    print "        </tr>\n";

    print "      </table></td>\n";

    print '        <td><p class="style5" align="justify"><strong>Main Description: </strong><br><br>' . "\n";

    print "{$record["MainDescription"]}\n";

    print '  </p><p class="style9">   <a href="mailto:?subject=';

    print "{$record["PropertyName"]}";

    print '">REGISTER INTEREST </a></p></td>' . "\n";

    print "  </tr>\n";

?>

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.