Solved

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

Posted on 2011-09-27
12
251 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
 

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

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how can display objects ? 3 24
Add css and js to MVC Project not in project 9 27
Javascript and Jquery not firing 9 42
Objects on Same Line 2 18
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now