?
Solved

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

Posted on 2011-09-27
12
Medium Priority
?
256 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
[X]
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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 2000 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

765 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