close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

dynamic image display problem

Thread began 2/02/2010 12:31 pm by jeffmg279672 | Last modified 2/12/2010 12:28 pm by jeffmg279672 | 1430 views | 5 replies

jeffmg279672

dynamic image display problem

Hi - the problem is more to do with preventing display of the "missing image" icon in the browser when there is no image in the db field. I have 2 pages - stockList.php and stockListDetail.php (code below) which allows for the possibility of up to 10 images to be stored in the db table. What's happening though is for a listing where there are only (say) 6 images, I'm then getting "missing image" icons showing on the page for images 7-10, which isn't what I want. Also these images are set to display as 100x100 px thumbnails, with a click-through from each to the full sized image. So what's happening with the missing images is that when clicked, the page reloads, which is also slightly annoying.
I assume that there's a way of setting this up so that if the db field is empty, nothing displays on the page - I've tried "show region if recordset is not empty" but that only seems to work on table rows, not cells...
Any ideas?
thanks in advance,
Jeff

------------------------
stockList.php code:
------------------------
<?php require_once('Connections/dollarbill.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}

mysql_select_db($database_dollarbill, $dollarbill);
$query_rsStock = "SELECT * FROM plantList";
$rsStock = mysql_query($query_rsStock, $dollarbill) or die(mysql_error());
$row_rsStock = mysql_fetch_assoc($rsStock);
$totalRows_rsStock = mysql_num_rows($rsStock);
?><?php
// RepeatSelectionCounter_1 Initialization
$RepeatSelectionCounter_1 = 0;
$RepeatSelectionCounterBasedLooping_1 = false;
$RepeatSelectionCounter_1_Iterations = "3";
?>
<!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=ISO-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="600" align="center" cellpadding="3">
<tr>
<td colspan="14">&nbsp;</td>
</tr>
<?php do { ?>
<tr>
<td>&nbsp;</td>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsStock){
?>
<td><a href="stockListDetail.php?recordID=<?php echo $row_rsStock['id']; ?>"><img src="<?php echo $row_rsStock['photo1']; ?>" width="100" height="100" border="0" /> </a> </td>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>&nbsp;</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsStock && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsStock = mysql_fetch_assoc($rsStock);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<td>&nbsp; </td>
</tr>
<?php } while ($row_rsStock = mysql_fetch_assoc($rsStock)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($rsStock);
?>

-----------------------
stockListDetail.php
-----------------------
<?php require_once('Connections/dollarbill.php'); ?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}

$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
}
mysql_select_db($database_dollarbill, $dollarbill);
$query_DetailRS1 = sprintf("SELECT * FROM plantList WHERE id = %s", GetSQLValueString($colname_DetailRS1, "int"));
$DetailRS1 = mysql_query($query_DetailRS1, $dollarbill) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($DetailRS1);
?><!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=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style9 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #FFFFFF; }
-->
</style>
</head>

<body>
<table width="600" align="center" cellpadding="3" bgcolor="#000000">
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><span class="style9">Make: <?php echo $row_DetailRS1['make']; ?> </span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Model: <?php echo $row_DetailRS1['model']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Year: <?php echo $row_DetailRS1['year']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Hours: <?php echo $row_DetailRS1['hours']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Weight: <?php echo $row_DetailRS1['weight']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Engine: <?php echo $row_DetailRS1['engine']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Condition: <?php echo $row_DetailRS1['cond']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Comments: <?php echo $row_DetailRS1['comments']; ?></span></td>
</tr>
<tr>
<td colspan="4"><span class="style9">Price excl. VAT: <?php echo $row_DetailRS1['price']; ?></span></td>
</tr>
<tr>
<td colspan="4"><img src="<?php echo $row_DetailRS1['photo1']; ?>" /></td>
</tr>
<?php if ($totalRows_DetailRS1 > 0) { // Show if recordset not empty ?>
<tr>
<td><a href="<?php echo $row_DetailRS1['photo2']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo2']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo3']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo3']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo4']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo4']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo5']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo5']; ?>" width="100" height="100" border="0" /></a></td>
</tr>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_DetailRS1 > 0) { // Show if recordset not empty ?>
<tr>
<td><a href="<?php echo $row_DetailRS1['photo6']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo6']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo7']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo7']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo8']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo8']; ?>" width="100" height="100" border="0" /></a></td>
<td><a href="<?php echo $row_DetailRS1['photo9']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo9']; ?>" width="100" height="100" border="0" /></a></td>
</tr>
<?php } // Show if recordset not empty ?>
<tr>
<td></td>
</tr>
<?php if ($totalRows_DetailRS1 > 0) { // Show if recordset not empty ?>
<tr>
<td><a href="<?php echo $row_DetailRS1['photo10']; ?>" target="_blank"><img src="<?php echo $row_DetailRS1['photo10']; ?>" width="100" height="100" border="0" /></a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<?php } // Show if recordset not empty ?>
</table>
</body>
</html><?php
mysql_free_result($DetailRS1);
?>
-----------------

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...