How to not to show additional image boxes in showing images in ASP?

Dear EE experts,

We would like to ask for tech support on how to remove those image boxes that don't have any image on it. It's because there's no image available on the db.
We just want to show images that are available on its db. Please see the attached screenshot & codes for it...

Thank you & hope to hear soon...
<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<tr> 
    
				<% dim iRow
				iRow=0
				Do Until rsProducts.EOF 
				image1 = rsProducts("path_image") & "/" & rsProducts("image1")
				image2 = rsProducts("path_image") & "/" & rsProducts("image2")
				image3 = rsProducts("path_image") & "/" & rsProducts("image3")
				image4 = rsProducts("path_image") & "/" & rsProducts("image4")
				image5 = rsProducts("path_image") & "/" & rsProducts("image5")
				image6 = rsProducts("path_image") & "/" & rsProducts("image6")
				 product_name = rsProducts("product_name")
				 download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 				if(download1 & ""= "") then
      				download1 = rsProducts("product_file")
      			if(download1&""<>"" ) then
          			download1="photo/"&download1
					'download1=download1
      			end if
				end if
				
				 download2 = rsProducts("path_download") & "" & rsProducts("download2")
 				 download3 = rsProducts("path_download") & "" & rsProducts("download3")
				 download4 = rsProducts("path_download") & "" & rsProducts("download4")				 
				 download5 = rsProducts("path_download") & "" & rsProducts("download5")				 
			   	%>

		</tr>
        <tr>
    		<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="5">
                      <b><%= product_name%></b>
        	</td>
    	</tr>
		<tr>
	    	<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
                	<%= GetImage(Image1,download1,product_name)%>
            </td>
		<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
                	<%= GetImage(Image2,download2,product_name)%>
            </td>
		<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
					<%= GetImage(Image3,download3,product_name)%>
            </td>
		<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
					<%= GetImage(Image4,download4,product_name)%>
            </td>
		<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
					<%= GetImage(Image5,download5,product_name)%>
            </td>
		<td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
					<%= GetImage(Image6,download5,product_name)%>
            </td>

	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="5" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window

remove-box.jpg
Stiebel EltronAsked:
Who is Participating?
 
EyalConnect With a Mentor Commented:
<table width="78%" border="0" cellspacing="3" cellpadding="1">
      <% dim iRow, DebugMode
      iRow=0
    DebugMode = false
      Do Until rsProducts.EOF
      image1 = GetImagePath(1)
      image2 = GetImagePath(2)
      image3 = GetImagePath(3)
      image4 = GetImagePath(4)
      image5 = GetImagePath(5)
      image6 = GetImagePath(6)
      product_name = rsProducts("product_name")
      download1 = iif(rsProducts("download1")&""="","",rsProducts("path_download") & "" & rsProducts("download1"))
                        
       if(download1 & ""= "") then
            download1 = rsProducts("product_file")
            if(download1&""<>"" ) then
                download1="photo/"&download1
            end if
      end if
      download2 = rsProducts("path_download") & rsProducts("download2")
       download3 = rsProducts("path_download") & rsProducts("download3")
      download4 = rsProducts("path_download") & rsProducts("download4")                        
      download5 = rsProducts("path_download") & rsProducts("download5")      
         if DebugMode = true      then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
      %>
    <tr>
          <td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
      <tr>
        <%= GetImage(Image1,download1,product_name)%>
        <%= GetImage(Image2,download2,product_name)%>
            <%= GetImage(Image3,download3,product_name)%>
            <%= GetImage(Image4,download4,product_name)%>
            <%= GetImage(Image5,download5,product_name)%>
            <%= GetImage(Image6,download5,product_name)%>
      </tr>
   <%
      iRow = iRow + 1
      if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
      <tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
      <%end if
      rsProducts.MoveNext()
Loop

Function iif(i,j,k)
      If i Then iif = j Else iif = k
End Function

Function GetImagePath(ImageIndex)
    GetImagePath = iif(rsProducts("image"&ImageIndex)&""="","",rsProducts("path_image") & rsProducts("image"&ImageIndex))
End Function

Function GetImage(Image,download,productname)
      dim RV, bGenerateLink
      RV = "<td align=""center"" bordercolor=""#000000"" bgcolor=""#FFFFFF"">"
    bGenerateLink = false
      if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
            If bGenerateLink  Then
                  RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
                  'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
            End If
            RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
            'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
            If bGenerateLink  Then
                  RV = RV & "</a>"
            End If
      end if
      GetImage = RV & "</td>"
End Function
%>
0
 
leakim971PluritechnicianCommented:
put this in the head section :

<script language="javascript" type="text/javascript">
window.onload = function() {
    var images = document.getElementsByTagName("img");
    for(var i=0;i<images.length;i++) {
         images[i].onerror = function() {
             this.src = "http://www.eicc.be/images/NoImageAvailable.jpg";
             //this.parentNode.removeChild(this);
         }
    }
}
</script>

Open in new window

0
 
Stiebel EltronAuthor Commented:
@leakim971: Still the same. I put it inside <head> </head> section, but the image box with "x" inside are still visible... :-(
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
leakim971PluritechnicianCommented:
could you give me a link to you page
0
 
Stiebel EltronAuthor Commented:
I'm sorry, but we don't have online, only local intranet...
0
 
EyalCommented:
Hi again stiebel,
probably it happens because the images are not found in the server.
please use this code (added some debug information that can help and made some order in the code also
if image will not be found what should happen? do you want to put some kind of default image?


<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = rsProducts("path_image") & "/" & rsProducts("image1")
	image2 = rsProducts("path_image") & "/" & rsProducts("image2")
	image3 = rsProducts("path_image") & "/" & rsProducts("image3")
	image4 = rsProducts("path_image") & "/" & rsProducts("image4")
	image5 = rsProducts("path_image") & "/" & rsProducts("image5")
	image6 = rsProducts("path_image") & "/" & rsProducts("image6")
    if
	product_name = rsProducts("product_name")
	download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & "" & rsProducts("download2")
 	download3 = rsProducts("path_download") & "" & rsProducts("download3")
	download4 = rsProducts("path_download") & "" & rsProducts("download4")				 
	download5 = rsProducts("path_download") & "" & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
            <%= GetImage(Image1,download1,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
            <%= GetImage(Image2,download2,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
			<%= GetImage(Image3,download3,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image4,download4,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image5,download5,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image6,download5,product_name)%>
        </td>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window


0
 
Stiebel EltronAuthor Commented:
Hello to you again Eyal!
Tried your advise & got this error result:
Microsoft VBScript compilation error '800a03ea'

Syntax error

/iphoto/asia2/ste-shower-units.asp, line 150

if
--^

Hope to hear again soon...
0
 
EyalCommented:
what if is located in 150 row? I don't have all the page code here :)
0
 
Stiebel EltronAuthor Commented:
Yes. It's the "If" statement... Please see the attached codes for reference.... :-)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Set connectString = Server.CreateObject("ADODB.Connection")
connectString.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("..\asia2\photo\products_asia.mdb") & ";"
connectString.Open

SeriesID = request.QueryString("SeriesID")

Set sqlContent = CreateObject("ADODB.Command")
sqlContent.ActiveConnection=connectString
sqlContent.Prepared = true

sqlContent.commandtext = "SELECT products.ID, products.seriesid, products.product_name, products.path_image, products.image1, products.image2, products.image3, products.image4, products.image5, products.image6, products.path_download, products.download1, products.download2, products.download3, products.download4, products.download5, products.product_file, products.updateby, products.updatedate, series.typeid, series.categoryid, series.brandid, series.series_name FROM products INNER JOIN series ON products.seriesid = series.seriesid WHERE products.seriesid=?"

sqlContent.Parameters.Append sqlContent.CreateParameter("@seriesid", 3, 1, , SeriesID)
Set rsProducts = sqlContent.Execute
if not rsProducts.eof then
series_name = rsProducts("series_name")
end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta name="Author" content="IT" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />

<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; I) [Netscape]" />


<title>..:: Stiebel Eltron's iPhoto Stock Gallery - Powered by STE IT Dept. ::..</title>
<style type="text/css">
<!--
	a
 	{
  		color:#000080;
		font-family:verdana;
		text-decoration:none;
		font-size:12px
	}
	
	
	a:active
 	{
  		color:red;

	}

	a:hover
 	{
  		color:#FF0000;
		text-decoration:none;
		cursor:crosshair;
	}
		
	table
	{
		font-family:verdana;
	}
	
	td
	{
		font-family:verdana;
		font-size:10e;
	}

	.b
	{
		font-color:#0A0EB7;
	}		

-->
</style>

<!--date-->
<script type="text/javascript">

<!-- Begin
dayName = new Array("", "¿¿¿¿¿¿", "¿¿¿¿¿¿", "¿¿¿", "¿¿¿¿¿¿¿¿", "¿¿¿¿¿", "¿¿¿¿¿", "¿¿¿¿¿¿¿")
monName = new Array("¿¿¿¿¿¿", "¿¿¿¿¿¿¿¿¿¿", "¿¿¿¿¿¿", "¿¿¿¿¿¿", "¿¿¿¿¿¿¿", "¿¿¿¿¿¿¿¿", "¿¿¿¿¿¿¿", "¿¿¿¿¿¿¿", "¿¿¿¿¿¿¿", "¿¿¿¿¿¿", "¿¿¿¿¿¿¿¿¿", "¿¿¿¿¿¿¿")
now = new Date
//  End -->
</script>

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

</head>

<body bgproperties="fixed" bgcolor="#000000" onload="javascript:startmenu()">
<table width="760" border="0" cellspacing="3" cellpadding="1">
  <tr>
    <td><img src="IMG/logo_res.jpg" alt="STIEBEL ELTRON" /></td>
    <td valign="top" bgcolor="#666666"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="548" height="197">
      <param name="movie" value="homeintro20.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <embed src="homeintro20.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="548" height="197"></embed>
    </object></td>
    <td><img src="IMG/white_square.png" alt="STIEBEL ELTRON" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right" bgcolor="#999999"><font face="Verdana, Geneva, sans-serif" color="#ffffff">
    <%
   '// If user is logged in show name and logout link
   If Session("loggedin") = true Then
      Response.Write "Welcome: " & Session("name")
      Response.Write "<br /><a href=""../asia2/login2/logout.asp"">Logout</a>"
   Else
      Response.Write "<a href=""ste-iphoto-login.asp"" title=""CLICK TO LOGIN"">REGISTERED USERS</a>"
   End If
	%>&nbsp;
	</td>
    <td bgcolor="#666666" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    
    <td align="left" bordercolor="#999999" bgcolor="#FFFFFF">
    » <img src="IMG/imgfolder.gif" alt="" />&nbsp;
       <%if rsProducts.eof then
	response.Write"STE Shower Units - <br><br><center>Sorry, there is no product images for that ID...</center>"
	else%>
    <a href="javaScript:menu0func()">STE Shower Units - <b><font face="verdana" size="+1"> - 
	<%=series_name%></font></b></a><%end if%>
	</td>
	<td bgcolor="#999999" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    
	<td align="left" bordercolor="#999999" bgcolor="#FFFFFF">
<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<tr> 
    
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = rsProducts("path_image") & "/" & rsProducts("image1")
	image2 = rsProducts("path_image") & "/" & rsProducts("image2")
	image3 = rsProducts("path_image") & "/" & rsProducts("image3")
	image4 = rsProducts("path_image") & "/" & rsProducts("image4")
	image5 = rsProducts("path_image") & "/" & rsProducts("image5")
	image6 = rsProducts("path_image") & "/" & rsProducts("image6")
    if
	product_name = rsProducts("product_name")
	download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & "" & rsProducts("download2")
 	download3 = rsProducts("path_download") & "" & rsProducts("download3")
	download4 = rsProducts("path_download") & "" & rsProducts("download4")				 
	download5 = rsProducts("path_download") & "" & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
            <%= GetImage(Image1,download1,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
            <%= GetImage(Image2,download2,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
			<%= GetImage(Image3,download3,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image4,download4,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image5,download5,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image6,download5,product_name)%>
        </td>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>        			

  		<tr>

Open in new window

0
 
Kiran SonawaneProject LeadCommented:
Try this

<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = rsProducts("path_image") & "/" & rsProducts("image1")
	image2 = rsProducts("path_image") & "/" & rsProducts("image2")
	image3 = rsProducts("path_image") & "/" & rsProducts("image3")
	image4 = rsProducts("path_image") & "/" & rsProducts("image4")
	image5 = rsProducts("path_image") & "/" & rsProducts("image5")
	image6 = rsProducts("path_image") & "/" & rsProducts("image6")
    if
	product_name = rsProducts("product_name")
	download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & "" & rsProducts("download2")
 	download3 = rsProducts("path_download") & "" & rsProducts("download3")
	download4 = rsProducts("path_download") & "" & rsProducts("download4")				 
	download5 = rsProducts("path_download") & "" & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
            <%= GetImage(Image1,download1,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
            <%= GetImage(Image2,download2,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
			<%= GetImage(Image3,download3,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image4,download4,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image5,download5,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image6,download5,product_name)%>
        </td>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
        Else
         RV = RV & "<img src=""http://www.eicc.be/images/NoImageAvailable.jpg""  style=""border:0px;""/>"
	end if
       
	GetImage = RV
End Function
%>

Open in new window

0
 
Stiebel EltronAuthor Commented:
@sonawanekiran: Tried it, but still the same... :-(
0
 
EyalCommented:
remove line 150

<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = rsProducts("path_image") & "/" & rsProducts("image1")
	image2 = rsProducts("path_image") & "/" & rsProducts("image2")
	image3 = rsProducts("path_image") & "/" & rsProducts("image3")
	image4 = rsProducts("path_image") & "/" & rsProducts("image4")
	image5 = rsProducts("path_image") & "/" & rsProducts("image5")
	image6 = rsProducts("path_image") & "/" & rsProducts("image6")
	product_name = rsProducts("product_name")
	download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & rsProducts("download2")
 	download3 = rsProducts("path_download") & rsProducts("download3")
	download4 = rsProducts("path_download") & rsProducts("download4")				 
	download5 = rsProducts("path_download") & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
            <%= GetImage(Image1,download1,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
            <%= GetImage(Image2,download2,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
			<%= GetImage(Image3,download3,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image4,download4,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image5,download5,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image6,download5,product_name)%>
        </td>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window

0
 
EyalCommented:
we can add code to check if images/downloads exist but you must tell us what you desire to happen
0
 
Stiebel EltronAuthor Commented:
What we desire to happen is to not to show those image boxes if there's no images in the db...

Please see the attached screenshot for the result from the latest codes that you advised...
remove-box2.jpg
0
 
EyalCommented:
try this...
<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = iif(rsProducts("image1")&""="","",rsProducts("path_image") & "/" & rsProducts("image1"))
	image2 = iif(rsProducts("image2")&""="","",rsProducts("path_image") & "/" & rsProducts("image2"))
	image3 = iif(rsProducts("image3")&""="","",rsProducts("path_image") & "/" & rsProducts("image3"))
	image4 = iif(rsProducts("image4")&""="","",rsProducts("path_image") & "/" & rsProducts("image4"))
	image5 = iif(rsProducts("image5")&""="","",rsProducts("path_image") & "/" & rsProducts("image5"))
	image6 = iif(rsProducts("image6")&""="","",rsProducts("path_image") & "/" & rsProducts("image6"))
	product_name = rsProducts("product_name")
	download1 = rsProducts("path_download") & "" & rsProducts("download1")
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & rsProducts("download2")
 	download3 = rsProducts("path_download") & rsProducts("download3")
	download4 = rsProducts("path_download") & rsProducts("download4")				 
	download5 = rsProducts("path_download") & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
            <%= GetImage(Image1,download1,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
            <%= GetImage(Image2,download2,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">
			<%= GetImage(Image3,download3,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image4,download4,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image5,download5,product_name)%>
        </td>
	    <td align="center" bordercolor="#000000" bgcolor="#FFFFFF">                
			<%= GetImage(Image6,download5,product_name)%>
        </td>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window

0
 
EyalCommented:
sorry missed the iif function

Function IIf(i,j,k)
	If i Then IIf = j Else IIf = k
End Function

Open in new window



put it before the GetImage function
0
 
Stiebel EltronAuthor Commented:
Kindly check the attached codes, and please let me know where did I made a mistake...
Still the same error result...
Loop

Function IIf(i,j,k)
	If i Then IIf = j Else IIf = k
End Function 

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = ""
        bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window

0
 
EyalCommented:
another improvement...
if there is error note me the line

<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<% dim iRow, DebugMode
	iRow=0
    DebugMode = true
	Do Until rsProducts.EOF 
	image1 = GetImagePath(1)
	image2 = GetImagePath(2)
	image3 = GetImagePath(3)
	image4 = GetImagePath(4)
	image5 = GetImagePath(5)
	image6 = GetImagePath(6)
	product_name = rsProducts("product_name")
	download1 = iif(rsProducts("download1")&""="","",rsProducts("path_download") & "" & rsProducts("download1"))
				
 	if(download1 & ""= "") then
      	download1 = rsProducts("product_file")
      	if(download1&""<>"" ) then
          	download1="photo/"&download1
      	end if
	end if
	download2 = rsProducts("path_download") & rsProducts("download2")
 	download3 = rsProducts("path_download") & rsProducts("download3")
	download4 = rsProducts("path_download") & rsProducts("download4")				 
	download5 = rsProducts("path_download") & rsProducts("download5")	
   	if DebugMode = true	then
        response.write("<tr><td colspan=""6"">" & image1 & "<br/>" &image2 & "<br/>" &image3 & "<br/>" &image4 & "<br/>" &image5 & "<br/>" &image6 & "</td></tr>")
    end if
	%>
    <tr>
    	<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="6">
            <b><%= product_name%></b>
        </td>
    </tr>
	<tr>
        <%= GetImage(Image1,download1,product_name)%>
        <%= GetImage(Image2,download2,product_name)%>
		<%= GetImage(Image3,download3,product_name)%>
		<%= GetImage(Image4,download4,product_name)%>
		<%= GetImage(Image5,download5,product_name)%>
		<%= GetImage(Image6,download5,product_name)%>
	</tr>
   <%
	iRow = iRow + 1
	if iRow mod 5 = 0 then ' let say you want to add empty line after 5 rows %>
	<tr><td colspan="6" bgcolor="#FFFFFF"></td></tr>
	<%end if
	rsProducts.MoveNext()
Loop

Function iif(i,j,k)
	If i Then iif = j Else iif = k
End Function

Function GetImagePath(ImageIndex)
    GetImagePath = iif(rsProducts("image"&ImageIndex)&""="","",rsProducts("path_image") & "/" & rsProducts("image"&ImageIndex))
End Function

Function GetImage(Image,download,productname)
	dim RV, bGenerateLink
	RV = "<td align=""center"" bordercolor=""#000000"" bgcolor=""#FFFFFF"">"
    bGenerateLink = false
	if Trim(Image & "") <>"" then
               bGenerateLink = (download&""<>"") and Session("loggedIn") = true
		If bGenerateLink  Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
			'RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		'RV = RV & "<img src=""" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If bGenerateLink  Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV & "</td>"
End Function
%>

Open in new window

0
 
Stiebel EltronAuthor Commented:
It removes the image boxes, but still have this:
PROD-IMG/Accessories//v_boo_dog01.jpg
PROD-IMG/Accessories//v_boo_dog02.jpg
PROD-IMG/Accessories//v_blue-rose.jpg
PROD-IMG/Accessories//v_blue-rose.jpg
above each row of images...

And is it possible to have only 1 "/" between Accessories & image filename?
0
 
Stiebel EltronAuthor Commented:
Excellent! I'll just check other details, regarding links for download & show image, but it worked!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.