Avatar of Stiebel Eltron
Stiebel Eltron
Flag for Thailand

asked on 

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
ASPWeb DevelopmentJavaScript

Avatar of undefined
Last Comment
Stiebel Eltron

8/22/2022 - Mon