EasyCFM.COM ColdFusion Forums / Coding Help! / Data Pagnation Challenges

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Data Pagnation Challenges

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

chrisdonkor
10-22-2012 @ 1:44 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 28
Joined: Apr 2008

I have an album database and I am trying to display the pictures one at a time with the next and previous buttons. For some reason, it is not working. This is my code:

<CFPARAM name="start" default="1" />
<CFPARAM name="disp" default="1" />

<CFQUERY DATASOURCE="#dbase#" NAME="SelectedCompany" dbtype="ODBC">
SELECT *
FROM photos, album
WHERE photos.album_id = album.album_id
AND photos.photo_id = #URL.photo_id#
</CFQUERY>

<CFSET end=Start + disp>
<CFIF start + disp GREATER THAN SelectedCompany.RecordCount>
<CFSET end=999>
<CFELSE>
<CFSET end=disp>
</CFIF>

<table border="0" align="center" cellpadding="10" bgcolor="#FF0000">
        <tr><td colspan="3"><CFOUTPUT query="SelectedCompany" startrow="#start#" maxrows="#end#">
                   <img src="../albumpics/#upload#" border="0">
        
</CFOUTPUT><!---
<CFOUTPUT query="SelectedCompany" startrow="#start#" maxrows="#end#">
                #CurrentRow#
   </CFOUTPUT> ---></td></tr>
        <CFOUTPUT>
                        <tr>
                            <!--- Display prev link --->
                            <CFIF start NOT EQUAL 1>
                                <CFIF start GTE disp>
                                    <CFSET prev=disp />
                                    <CFSET prevrec=start - disp />
                                <CFELSE>
                                    <CFSET prev=start - 1 />
                                    <CFSET prevrec=1 />
                                </CFIF>
                                <td height="40"><font face="wingdings">ç</font> <a href="test.cfm?album_id=#album_id#&photo_id=#photo_id#&start=#prevrec#"> <font color="##009900">Previous #prev# records</font></a></td>
                            </CFIF>
                            <!--- Display next link --->
                            <CFIF end LT SelectedCompany.RecordCount>
                                <CFIF start + disp * 2 GTE SelectedCompany.RecordCount>
                                    <CFSET next=SelectedCompany.RecordCount - start - disp + 1 />
                                <CFELSE>
                                    <CFSET next=disp />
                                </CFIF>
                                <a href="test.cfm?album_id=#album_id#&photo_id=#photo_id#&start=#Evaluate("start + disp")#">Next #next# records</a> <font face="wingdings">è</td>
                           </cfif>
                       </tr></CFOUTPUT>
                   </table>

I will be very grateful some quick help


Stay Blessed
Christian Adusu-Donkor
Managing Consultant
(DOT House: websites & beyond)

Webmaster
11-09-2012 @ 9:29 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

Define not working.. it loads but wont switch images..
or it throws an actual error?

<CFIF start + disp GREATER THAN
SelectedCompany.RecordCount>

should be:

<CFIF val(start + disp) GT
val(SelectedCompany.RecordCount)>

Let me know...


Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email

\m/ (>.<) \m/
--- rock on ---


Website Designed and Developed by Pablo Varando.