Solved

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

Posted on 2011-09-27
12
252 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

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.

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

773 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