Solved

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

Posted on 2011-09-27
12
250 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 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)

760 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

19 Experts available now in Live!

Get 1:1 Help Now