Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
ASP Photo Gallery - Page problem
Old 03-19-2006, 07:13 PM ASP Photo Gallery - Page problem
Junior Talker

Posts: 2
Trades: 0
Hi

I am trying to write a page which will display 10 images in rows of 4 from database records. While I have managed to write the 4 images in a row, I have not managed to make the code which will allow you to move between pages to see images beyond 10 etc.

Instead, I get "Displaying 1 - 10 of -1 Pictures. Pages: [ 1 ]" when it should be Displaying 1 - 10 of 34 Pictures. Pages: [ 1 2 3 ] with 2 and 3 linking to the pages.

----- BEGIN CODE -----

i = 1
if isnumeric(request("i")) and request("i") <> "" then i = request("i")
Sql = "SELECT * FROM images WHERE album = " & i & " ORDER BY name"
set sl = db.Execute(Sql)

DIM intPageRecords, intRecords, intRecordCount, intCurrentPage
DIM intNumberOfPages, intDisplayPage
intPageRecords = Request.Querystring("page")
IF intPageRecords = "" THEN intPageRecords = 1 : intRecords = 1
intRecords = intPageRecords
intPageRecords = ((intPageRecords - 1) * 10) +1
intRecordCount = 0

if not sl.EOF or not sl.BOF then

sl.move (intPageRecords - 1)

%>
<TABLEBORDER=0CELLPADDING=4CELLSPACING=0WIDTH="100%"><%
Sql = "SELECT * FROM albums WHERE id = " & i
set sl2 = db.Execute(Sql)
if not sl2.EOF or not sl2.BOF then
name = sl2("name")
desc = sl2("description")
end if
set sl2 = NOTHING
%>
<tr><TDNOWRAPVALIGN=TOPcolspan=4><ahref="<%=Request.ServerVariables("url") %>"><u>Pictures</u></a><strong><font color="#084A8D"><u> &raquo; <%=name %></u></strong></font><P></td></tr><%

cnt = 0
DO WHILE intRecordCount < 10 and NOT sl.EOF
id = sl("id")
filename = "SJa/" & sl("filename")
name = sl("name")
cnt = cnt + 1
if cnt = 5 then cnt = 1
if cnt = 1 then Response.write "<tr>"
%>
<TDVALIGN=TOPwidth="25%"><center><ahref="javascript:Start('SJa_Show_Pic.asp?a=image&i=<%=i d %>')"><imgsrc="<%=filename %>"height=80border=0><br><%=name %></a></center><p></td><%

if cnt = 4 then Response.Write "</tr>"
sl.movenext
intRecordCount = intRecordCount +1
loop
if cnt = 1 then Response.Write "<TD NOWRAP VALIGN=TOP width=""25%"">&nbsp;</td>"

if cnt <= 2 then Response.Write "<TD NOWRAP VALIGN=TOP width=""25%"">&nbsp;</td>"

if cnt <= 3 then Response.Write "<TD NOWRAP VALIGN=TOP width=""25%"">&nbsp;</td></tr>"

%>
</table>

<%
else
%>
<TABLEBORDER=0CELLPADDING=4CELLSPACING=0WIDTH="100%"><tr><TDNOWRAPVALIGN=TOP><!--<pre>--><ahref="<%=Request.ServerVariables("url") %>"><u>Pictures</u></a><!--</pre>--><p>Coming Soon...</td></tr></table><p><%
end if
%>

Displaying <%=intPageRecords%> - <%=intPageRecords+(intRecordCount-1)%> of <%=(sl.RecordCount)%> Pictures.

<%
intCurrentPage = Request.Querystring("page")
IF intCurrentPage = "" THEN intCurrentPage = 1
intNumberOfPages = int(sl.RecordCount \ 10)
IF sl.RecordCount MOD 10<> 0 THEN intNumberOfPages = intNumberOfPages + 1
Response.Write("Pages: [")
FOR intDisplayPage = 1 TO intNumberOfPages
IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
Response.Write " <b>" & intDisplayPage & "</b> "
ELSE
Response.Write " <a href=""sja_pictures.asp?a=path&i=" & i & "&page=" & intDisplayPage & """>" & intDisplayPage &_
"</a> "
END IF
NEXT
Response.Write ("]")

set sl = NOTHING


----- END CODE -----

I have managed to get the number of records per page code to work on a quotes section of my site (http://www.waynieoaks.co.uk/sja_quotes.asp)

So I know the problem is the two sets of code on one page - but can not work it out. The non-live example of this problem can be seen at http://waynieoaks.boldlygoingnowhere...sp?a=path&i=23

Thank you for any help anyone can provide - I am by far not an expert at ASP code.
wb228 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-20-2006, 05:22 PM Re: ASP Photo Gallery - Page problem
Junior Talker

Posts: 2
Trades: 0
Have found a different way to do it - script now working...

Thanks to: http://www.aspin.com/func/content?tr...gre&id=4410410
wb228 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ASP Photo Gallery - Page problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39411 seconds with 12 queries