Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to resolve the error result in showing image with the same SeriesID using ASP?

Posted on 2011-09-27
12
253 Views
Last Modified: 2012-05-12
Dear EE experts,

We would like to ask on how to resolve the attached script.
As you can see from the attached screenshot (Same SeriesID), you'll see from the db the SeriesID = 116, it has 2 rows that has the same SeriesID, but different image. if we try to open it from the web browser, it gives us error result (please see the Same SeriesID from WEB). But if there's 1 SeriesID from the DB, it's working smoothly.

- Kindly advise on how to resolve this error with the same SeriesID...
- How if there would be another product name BUT same SeriesID (as can see from the db screenshot), how to put it on the next row & not be mix on the same row?
For example:
SeriesID=116
AQ Manual - <photo>, <photo>, etc...
AQ 00Manual - <photo>, <photo>, etc...

Thank you & hope to hear soon from experts :-)
<table width="78%" border="0" cellspacing="3" cellpadding="1">
	<tr> 
				<% dim iRow
				iRow=0
				Do Until rsProducts.EOF 
				image1 = rsProducts("image1")
				image2 = rsProducts("image2")
				image3 = rsProducts("image3")
				image4 = rsProducts("image4")
				image5 = rsProducts("image5")
				 product_name = rsProducts("product_name")
				 download1 = rsProducts("download1")
				 download2 = rsProducts("download2")
 				 download3 = rsProducts("download3")
				 download4 = rsProducts("download4")				 
				 download5 = rsProducts("download5")				 
			   	%>

		</tr>
        <tr>
    		<td style="background-color:#FFFFFF;border-color:#999999;text-align:left;vertical-align:top;" colspan="5">
                      <%= product_name%>
        	</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>
	</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
	RV = ""
	if Trim(Image & "") <>"" then
		If Session("loggedIn") = true Then
			RV = RV & "<a href=""" & Replace(download, "DOWNLOAD", "photo/download") & """>"
		End If
		RV = RV & "<img src=""photo/" & image & """ alt=""" & Server.HTMLEncode(productname) &""" style=""border:0px;""/>"
		If Session("loggedIn") = true Then
			RV = RV & "</a>"
		End If
	end if
	GetImage = RV
End Function
%>

Open in new window

Same-SeriesID.jpg
Same-SeriesID-web.jpg
0
Comment
Question by:Stiebel Eltron
  • 6
  • 6
12 Comments
 
LVL 15

Expert Comment

by:Eyal
ID: 36708431
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") & """>"
		End If
		RV = RV & "<img src=""photo/" & 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
 

Author Comment

by:Stiebel Eltron
ID: 36708500
It shows but, how if the item isn't under the "download" column anymore, it's under product_file column. Please see the attached screenshot...
Because some of the items are not all under download columns, there's 1 product_file which is for PDF files...
Product-file.jpg
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36708513
I understand you have image1 set and download1 empty and product_file set.

is that correct?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:Stiebel Eltron
ID: 36708592
image2 - download5 is empty, except for the product_file column.
That is for the PDF files only...
0
 
LVL 15

Accepted Solution

by:
Eyal earned 500 total points
ID: 36708608
download1 = rsProducts("download1")
if(download1 & ""= "") then
download1 = rsProducts("product_file")
end if
0
 

Author Comment

by:Stiebel Eltron
ID: 36708617
where do I need to insert that? :-(
0
 
LVL 15

Assisted Solution

by:Eyal
Eyal earned 500 total points
ID: 36708716
you have the first line already (line 12)
add the other 3
0
 

Author Comment

by:Stiebel Eltron
ID: 36710300
Hi there Eyal! Sorry for the late reply... home already...
It becomes clickable now, but how to insert the folder location "photo" before PDF?
Like from the "download" link, you have the script there, the column now is not download, but product_file...
Bec. right now it's clickable but can't open the pdf file because of its location path, missing the folder "photo" before the product_file location...

Thank you!
0
 

Author Closing Comment

by:Stiebel Eltron
ID: 36710315
Hi there Eyal! Sorry for the late reply... home already...
It becomes clickable now, but how to insert the folder location "photo" before PDF?
Like from the "download" link, you have the script there, the column now is not download, but product_file...
Bec. right now it's clickable but can't open the pdf file because of its location path, missing the folder "photo" before the product_file location...

Thank you!
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36714345
change this....
if(download1 & ""= "") then
     download1 = rsProducts("product_file")
end if

Open in new window


with this...
if(download1 & ""= "") then
      download1 = rsProducts("product_file")
      if(download1&""<>"" ) then
          download1="photo/"&download1
      end if
end if

Open in new window

0
 

Author Comment

by:Stiebel Eltron
ID: 36714532
Thank you very much Eyal! Can I add you more points? Please let me know how... lol
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36714592
always happy to help
next time put the question more points from the beginning :)

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question