One of the main things all developers come to in applications is pagination and the best way we found to do this is by Raymond Camden which covers how to create next and previous buttons for your content using the URL variable.

As we have extended what Raymond Camden has done we will go through all the code again to make sure you get the full picture.

First part is to get our data, which most of the time will be a database or as the second data example shows a queryNew which is a way of creating data in a query format without the need of a database query.

<cfquery name=”data” datasource=”data_dsn”>

SELECT *
FROM data

</cfquery>

OR

<cfset data = queryNew(“id,name,age,active”,”integer,varchar,integer,bit”)>

<cfloop index=”x” from=”1″ to=”22″>
<cfset queryAddRow(data)>

<cfset querySetCell(data,”id”,x)>
<cfset querySetCell(data,”name”,”User #x#”)>
<cfset querySetCell(data,”age”,randRange(20,90))>

<cfset querySetCell(data,”active”,false)>


</cfloop>

Next we want to set the number of records per page we would like to show, for this example code we are using 10:

<cfset perpage = 10>

Now we create the code for the URL variables which counts the records in the data we have got from our database / query. We also set the default of the variable URL.start to 1 as we want to start from the first record and not 0.

<cfparam name=”url.start” default=”1″>

<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt data.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
</cfif>

The output of the data, you will notice on our <cfoutput> tag we have startrow & maxrows which sets what records are displayed.

<cfoutput query=”data” startrow=”#url.start#” maxrows=”#perpage#”>
#currentrow#) #name#<br />
</cfoutput>

And now this is when the code that Raymond Camden created changes a little to add in a new feature, page numbering. We first have a previous link which has an if statement around it to see if its a link or not and enable the <a> tag or have no link on it. This can be done different ways but to keep with Raymond Camden’s code we will leave it as it is. Now the new part you can see within the commented area (<!— Start Page Number —> CODE <!— End Page Number —>) we set 2 variables one for a page count as we need to have a number of pages that will be listed. The next one is page link, this is to fit in with the rest of the code and add the number that will need to be added within the link to view the numbered page. Next is a loop to go through the number of pages with the link and a small bit of VERY simple maths to add up the next page through the loop.

<p align=”center”>

[

<cfif url.start gt 1>

<cfset link = cgi.script_name & “?start=” & (url.start – perpage)>

<cfoutput><a href=”#link#”>Previous Page</a></cfoutput>

<cfelse>

Previous Page

</cfif>

/

<!— Start Page Number —>

<cfset pageCount = 1>
<cfset pageLink = 1>

<cfset totalPages = Ceiling(rs_getReports.recordCount / perpage)>

<cfloop index=”c” from=”1″ to=”#totalPages#”>

<cfoutput>

<a href=”?start=#pageLink#”>#pageCount#</a>

</cfoutput>

<cfset pageCount = pageCount + 1>

<cfset pageLink = pageLink + perpage>

</cfloop>

<!— End Page Number —>

/

<cfif (url.start + perpage – 1) lt rs_getReports.recordCount>

<cfset link = cgi.script_name & “?start=” & (url.start + perpage)>

<cfoutput><a href=”#link#”>Next Page</a></cfoutput>

<cfelse>

Next Page

</cfif>

]

</p>

Thats it, you will now have something that looks like this:

Paging
Base code taken from Raymond Camden’s coldfusionjedi.com :

http://www.coldfusionjedi.com/index.cfm/2006/4/24/ColdFusion-and-Pagination

Join the conversation! 971 Comments

  1. ivermectin 3mg tablets price stromectol – stromectol covid 19
    http://stromectolabc.com/ stromectol liquid
    stromectol pills stromectol1st ivermectin price comparison

    Reply
  2. buy cheap generic zithromax order zithromax over the counter zithromax 500 without prescription
    https://azithromycin1st.com/ zithromax for sale cheap
    zithromax 250 mg zithromax z-pak price without insurance zithromax online usa no prescription

    Reply
  3. where can you buy zithromax zithromax online paypal buy zithromax 1000mg online
    https://azithromycin1st.com/ buy zithromax online with mastercard
    zithromax capsules buy zithromax online zithromax z-pak price without insurance

    Reply
  4. where can i buy zithromax uk zithromax 500mg price in india where can i buy zithromax capsules
    https://azithromycin1st.com/ generic zithromax over the counter
    zithromax 250 where can i get zithromax over the counter generic zithromax azithromycin

    Reply
  5. zithromax for sale usa buy cheap zithromax online buy cheap zithromax online
    https://azithromycin1st.com/ zithromax 1000 mg pills
    zithromax cost australia zithromax for sale 500 mg where can i buy zithromax medicine

    Reply
  6. zithromax 250 mg tablet price zithromax 500mg over the counter zithromax generic price
    https://azithromycin1st.com/ zithromax for sale usa
    buy azithromycin zithromax buy zithromax no prescription zithromax price south africa

    Reply
  7. prescription drugs without doctor approval prescription drugs without prior prescription pain medications without a prescription
    https://without-prescription-online.online/ prescription drugs without doctor approval
    discount prescription drugs buy prescription drugs without doctor pain meds online without doctor prescription

    Reply
  8. canadian online drugs buy prescription drugs buy prescription drugs from canada
    https://without-prescription-online.online/ canadian drug pharmacy
    pain medications without a prescription canadian drugstore online canadian drug prices

    Reply
  9. buy prescription drugs without doctor prescription meds without the prescriptions prescription drugs online without doctor
    https://without-prescription-online.online/ canadian drug pharmacy
    best online canadian pharmacy canada ed drugs cheap pet meds without vet prescription

    Reply
  10. cialis coupon cvs – tadalafil uk order cialis 40mg pills

    Reply
  11. movfor molnupiravir price movfor
    https://apollobgshospitalsmysore.online/ where can i buy paxlovid
    molnupiravir india molnupiravir buy molnupiravir online

    Reply
  12. paxlovid for sale paxlovid price buy paxlovid
    https://myalliancehealthcare.online/ molnupiravir india
    purchase paxlovid paxlovid cost cheap paxlovid

    Reply
  13. cheap paxlovid paxlovid cost where can i buy paxlovid
    https://apollobgshospitalsmysore.online/ paxlovid for sale
    paxlovid paxlovid price buy paxlovid online

    Reply
  14. molnupiravir price where can i get molnupiravir cheap molnupiravir
    https://apollobgshospitalsmysore.online/ buy paxlovid online
    paxlovid cost where can i get paxlovid where can i buy paxlovid

    Reply
  15. purchase plaquenil pills – order hydroxychloroquine 200mg generic buy plaquenil 400mg sale

    Reply
  16. stromectol uk buy: buy stromectol – stromectol
    http://stromectolst.com/# stromectol 3 mg
    ivermectin tablets order can you buy stromectol over the counter stromectol cost

    Reply
  17. ivermectin 1 cream – buy stromectol stromectol stromectol 6mg online

    Reply
  18. ivermectin lotion price: cheap stromectol – ivermectin 2ml
    http://stromectolst.com/# ivermectin 1 cream
    stromectol for humans stromectol tab price ivermectin australia

    Reply
  19. order cephalexin without prescription – erythromycin 500mg canada erythromycin 250mg oral

    Reply
  20. fildena 50mg canada – order disulfiram 500mg online order antabuse 500mg without prescription

    Reply
  21. https://stromectolis.com/# stromectol tablets for humans

    Reply
  22. rhinocort over the counter – purchase cefuroxime pill buy cefuroxime 250mg generic

    Reply
  23. https://stromectolis.com/# buy ivermectin for humans uk

    Reply
  24. oral careprost – robaxin us buy trazodone for sale

    Reply
  25. https://stromectolis.com/# п»їorder stromectol online

    Reply
  26. sildenafil overnight delivery – order generic ranitidine 300mg order zantac online

    Reply
  27. cialis medication – buy cialis sale ivermectin 12mg

    Reply
  28. clomid generic order clomiphene – clomid buy online
    https://clomiphene1st.com/# clomid capsules 50mg

    Reply
  29. cialis without a doctor prescription – ivermectin purchase best place to buy ed pills online

    Reply
  30. order doxycycline online doxylin – doxycycline pills
    https://doxycyline1st.com/# doxycycline without prescription

    Reply
  31. casino online real money – prednisone 5mg drug order prednisone 40mg pills

    Reply
  32. doxycycline 100 mg purchase doxycycline online – buy cheap doxycycline
    https://doxycyline1st.com/# generic doxycycline

    Reply
  33. buy prednisone 10mg pills – buy isotretinoin pills buy isotretinoin 40mg for sale

    Reply
  34. cheap generic amoxicillin – amoxil 250mg us buy sildenafil 50mg sale

    Reply
  35. generic for doxycycline buy doxycycline online – buy generic doxycycline
    https://doxycyline1st.com/# buy doxycycline cheap

    Reply
  36. How long does it take to get a digital game code? How do I remove my iHerb rewards
    discount?

    10% OFF April 2022 VOUCHER for OpenMedShop http://openmedshop.com is:
    MEDS10

    How do I get Uniqlo discounts? Can you use 2 coupons at Children’s Place?

    Reply
  37. prices of cialis – purchase tadalafil pills cheap tadalafil for sale

    Reply
  38. can i buy viagra over the counter walgreens viagra substitute viagra over the counter usa 2018

    Reply
  39. ivermectin medicine – ivermectin over the counter canada azithromycin 500mg oral

    Reply
  40. does viagra work the first time? what happens when a girl takes viagra does medicare pay for viagra

    Reply
  41. zithromax 500mg oral – medrol uk methylprednisolone 16mg otc

    Reply
  42. half life of plaquenil plaquenil and covid19 plaquenil reviews

    Reply
  43. molnupiravir stock price merck pill for covid mulnopiravir

    Reply
  44. buy baricitinib 2mg pills – priligy 30mg without prescription priligy 90mg cheap

    Reply
  45. ivermectin india ivermectin purchase minocycline 100 mg without doctor

    Reply
  46. purchase glucophage online – oral atorvastatin 10mg order generic lipitor 10mg

    Reply
  47. hcq 400 mg how does plaquenil work for lupus plaquenil vs chloroquine

    Reply
  48. norvasc sale – order amlodipine sale order omeprazole 10mg sale

    Reply
  49. merck covid pill merck antiviral molnupiravir merck covid

    Reply
  50. order metoprolol 50mg online cheap – lopressor drug cost tadalafil 20mg

    Reply
  51. tadalafil 10mg generic – sildenafil online order viagra 150mg generic

    Reply
  52. cialis\’ cialis online no prescription cialis without prescription,bc

    Reply
  53. ivermectin 0.5% – ivermectin 6mg tablet ivermectin dose for covid

    Reply
  54. Looking forward to reading more. Great blog article. Really Cool.

    Reply
  55. cialis store in qatar cialis no prescription arizona cialis free trial voucher 2019

    Reply
  56. Enjoyed every bit of your blog post.Really thank you! Cool.

    Reply
  57. Great, thanks for sharing this post.Much thanks again. Want more.

    Reply
  58. Thanks for the blog post.Really thank you! Really Great.

    Reply
  59. buy clomiphene – albuterol order cetirizine 10mg canada

    Reply
  60. side effects of ivermectin ivermectin? ivermectin for coronavirus mayo clinic

    Reply
  61. order desloratadine 5mg generic – cheap triamcinolone 10mg aristocort 4mg pills

    Reply
  62. Wow, great article.Really thank you! Fantastic.

    Reply
  63. Thank you ever so for you blog article.Really looking forward to read more. Really Cool.

    Reply
  64. soolantra ivermectin cream 1 ivermectin dosage for cats ivermectin antiparasitic

    Reply
  65. order cytotec generic – prednisolone online levothyroxine price

    Reply
  66. Major thankies for the blog article.Much thanks again. Awesome.

    Reply
  67. equine ivermectin paste ivermectin stock price today ivermectin guinea pigs

    Reply
  68. order sildenafil 50mg – viagra 100mg pills for sale order gabapentin 100mg generic

    Reply
  69. What i don’t realize is if truth be told how you’re now not actually much more neatly-appreciated than you may be right now.

    You’re so intelligent. You recognize thus significantly in terms of
    this matter, produced me in my view consider it from a lot of varied angles.
    Its like women and men aren’t fascinated unless it’s
    something to accomplish with Woman gaga! Your personal stuffs outstanding.
    All the time take care of it up!

    Reply
  70. buy generic tadalafil 5mg – buy tadalafil pills order cenforce 100mg generic

    Reply
  71. Really enjoyed this blog post.Really looking forward to read more.

    Reply
  72. buy cheap amoxicillin amoxicillin tablet 500mg amoxicillin online purchase

    Reply
  73. order diltiazem generic – order zyloprim 100mg online cheap oral acyclovir

    Reply
  74. buy atarax sale – buy rosuvastatin 10mg generic buy rosuvastatin for sale

    Reply
  75. clomid for sale online with no prescription clomid order online uk п»їclomid online sale

    Reply
  76. Really informative post.Really thank you!

    Reply
  77. A big thank you for your article.Thanks Again.

    Reply
  78. Very good article post.Really looking forward to read more. Cool.

    Reply
  79. wow, awesome article post.Thanks Again. Keep writing.

    Reply
  80. Really enjoyed this article post.Much thanks again. Really Great.

    Reply
  81. buy generic ezetimibe 10mg – buy celexa online cheap citalopram order online

    Reply
  82. viagra online mexican pharmacy viagra and cost viagra deals

    Reply
  83. what is the use of sildenafil citrate tablets side effects of sildenafil 20 mg

    Reply
  84. order viagra 50mg pill – generic flexeril flexeril 15mg canada

    Reply
  85. can i buy clomid over the counter in south africa buy clomid pills real clomid for sale

    Reply
  86. Major thanks for the blog article.Much thanks again. Awesome.

    Reply
  87. wow, awesome blog post.Thanks Again. Really Great.

    Reply
  88. I cannot thank you enough for the article post.Really looking forward to read more. Much obliged.

    Reply
  89. I really liked your article.Much thanks again. Really Great.

    Reply
  90. buy sildenafil online cheap – cheap cialis pills buy cialis 10mg sale

    Reply
  91. My brother suggested I might like this web site.

    He was totally right. This post actually made my day. You cann’t imagine
    simply how much time I had spent for this information! Thanks!

    Look into my web blog … situs slot online

    Reply
  92. where to get clomid in south africa clomid 25 buy clomid pills

    Reply
  93. order toradol without prescription – buy zanaflex pills baclofen 25mg cost

    Reply
  94. wow, awesome blog.Really looking forward to read more. Awesome.

    Reply
  95. colchicine pills – brand colchicine strattera brand

    Reply
  96. Thank you ever so for you article post. Great.

    Reply
  97. cialis for bph dosage how to get cialis prescription cheapest cialis tadalafil 20 mg

    Reply
  98. viagra 50mg cheap – sildenafil on line viagra on line

    Reply
  99. I really liked your blog article.Thanks Again. Will read on…

    Reply
  100. buy nexium 40mg sale – buy promethazine 25mg for sale promethazine canada

    Reply
  101. cialis 20mg ca – Buy cialis in us order generic cialis 5mg

    Reply
  102. order modafinil 200mg pill – best canadian pharmacies top ed pills

    Reply
  103. Awesome blog.Thanks Again. Really Cool.

    Reply
  104. isotretinoin 10mg pill – azithromycin canada azithromycin 250mg cheap

    Reply
  105. cialis 20 mg from canada order cialis no prescription cialis by mail

    Reply
  106. Major thankies for the post.Much thanks again. Great.

    Reply
  107. order lasix 100mg pill – buy lasix 100mg online cheap sildenafil 150mg usa

    Reply
  108. Really appreciate you sharing this post.Much thanks again. Much obliged.

    Reply
  109. tadalafil canada – guaranteed viagra overnight delivery usa order sildenafil 100mg generic

    Reply
  110. Im thankful for the blog article.Really thank you! Want more.

    Reply
  111. ivermectin sheep drench tractor supply ivermectin guinea pigs does ivermectin kill coccidia

    Reply
  112. cialis 20mg price – order tadalafil 5mg generic coumadin pills

    Reply
  113. I cannot thank you enough for the blog post.Thanks Again. Want more.

    Reply
  114. Huomaa, että parittoman low-käden arvo lasketaan aina korkeimmasta kortista alaspäin. Esimerkiksi käsi #10 on “6-low”, koska korkein kortti on kuusi. Käsi #9 on “9-low” ja käsi #5 on “K-low”. Pokeritermeissä low-kädet erotetaan arvojärjestyksessä, joten käsi #11 on “6-4-low”, joka voittaa käden #10 “6-5-low”. Ilmainen pokeri on hyvä mahdollisuus hioa oma pokeristrategia kuntoon sekä oppia useamman eri pokerivariaation säännöt. Jos siis olet vasta aloittelemassa pokerin pelaamista, sinun kannattaa ehdottomasti hyödyntää mahdollisuus kokeilla peliä ensin ilmaiseksi. Olet ehkä nähnyt pokerikohtauksen elokuvassa tai televisiossa, kun pelaaja kohtaa panostuksen suuremmalla pelimerkkimäärällä kuin hänellä on pöydässä, ja hän joutuu panostamaan kellonsa, autonsa tai jotain muuta omaisuuttaan pysyäkseen mukana kädessä. Tämä voi toimia hyvin draaman kannalta, mutta pokeria ei yleensä pelata näin oikeassa elämässä! https://ask.primarykamaster.org/profile/lavonnewhitty9/ Lauantai-Jokerissa pelaaja valitsee seitsemän numeroa väliltä 0-9, ja virallisen arvonnan seitsemää arvottua numeroa verrataan omaan numerosarjaan. Mitä enemmän saat osumia, sitä enemmän voitat – peli-idea on selkeä ja yksinkertainen. Lauantai-Jokerin tulokset julkaistaan virallisen lottoarvonnan yhteydessä lauantai-iltaisin. Online-keno-maksut vaihtelevat käytetyn kasinon mukaan. Keno-sivustot tarjoavat erilaisia pisteitä, kertoimia ja voittosummia, jotka vaikuttavat voittoihisi. Monet uskovat keno-voiton olevan korkeampi useammalle saamallesi numerolle, mutta voitat enemmän saamalla suuren prosenttiosuuden valitsemistasi numeroista. Jos olet ensimmäistä kertaa pelaamassa kenoa netissä, voit kokeilla aluksi leikkirahalla pelaamista. Ilmainen keno on loistava tapa kokeilla peliä ennen oikealla rahalla pelaamista. Keno netissä on helppokäyttöinen, sillä sinun tulee kierroksen alussa valita yhdestä kymmeneen numeroa. Numerot valitaan ruudukosta, johon on listattu kaikki pelinumerot. Valitsemalla useita numeroita nostat pelattavaa kenotasoa, jolloin voittotaulukon kertoimet nousevat nopeasti. Kun olet valinnut haluamasi määrän numeroita, riville tulee asettaa panos. Viimeisenä vaiheena tulee vahvistaa rivi ja tämän jälkeen jäät odottamaan itse arvontaa. Monilla kasinoilla arvontoja on todella usein, jopa minuutin välein.

    Reply
  115. Enjoyed every bit of your blog post.Much thanks again. Fantastic.

    Reply
  116. order topiramate 200mg online – topamax for sale online imitrex 50mg pills

    Reply
  117. dutasteride online – avodart 0.5mg ca generic cialis 10mg

    Reply
  118. use cialis promise coupon orlando fl cialis 5 mg cialis picture

    Reply
  119. Thank you for your blog.Really thank you!

    Reply
  120. difference between tadalafil and sildenafil tadalafil 20mg lowest price

    Reply
  121. order viagra 100mg online cheap – viagra buy online order tadalafil 20mg for sale

    Reply
  122. Great blog article.Really looking forward to read more. Will read on…

    Reply
  123. Really informative blog post.Really looking forward to read more. Great.

    Reply
  124. I appreciate you sharing this article post. Fantastic.

    Reply
  125. blue pill for ed – prednisone 5mg canada prednisone 5mg sale

    Reply
  126. I think this is a real great blog post. Really Great.

    Reply
  127. Hey, thanks for the blog post.Really thank you! Fantastic.

    Reply
  128. I think this is a real great blog.Much thanks again. Great.

    Reply
  129. cost accutane 10mg – buy amoxicillin 500mg pills buy amoxicillin 1000mg generic

    Reply
  130. buy clomid online from canada where to get clomid clomid 100mg price in india

    Reply
  131. Thanks again for the blog article.Much thanks again. Really Cool.

    Reply
  132. I think this is a real great article. Really Great.

    Reply
  133. furosemide 40mg ca – buy zithromax 250mg online buy azithromycin 250mg pills

    Reply
  134. A round of applause for your blog article.Really thank you! Much obliged.

    Reply
  135. Enjoyed every bit of your article.Really looking forward to read more. Awesome.

    Reply
  136. amoxicillin 875 125 mg tab amoxicillin 875 mg tablet amoxicillin price without insurance

    Reply
  137. I appreciate you sharing this post.Thanks Again. Really Cool.

    Reply
  138. buy doxycycline 200mg online cheap – hydroxychloroquine usa chloroquine 250mg uk

    Reply
  139. I cannot thank you enough for the article.Really looking forward to read more. Keep writing.

    Reply
  140. Major thanks for the article.Really looking forward to read more. Great.

    Reply
  141. cost doxycycline tablets uk doxycycline 40 mg generic cost buy doxycycline online nz

    Reply
  142. canadian pharmacies that don’t require prescriptions humana online pharmacy

    Reply
  143. I truly appreciate this blog post.Much thanks again. Cool.

    Reply
  144. prednisone 20mg for sale prednisone 250 mg can i buy prednisone online without a prescription

    Reply
  145. A round of applause for your post.Much thanks again. Cool.

    Reply
  146. grasp your rss feed as I can not in finding your email subscription link or e-newsletter service. Do you?ve any?

    Reply
  147. Very good post.Thanks Again. Awesome.

    Reply
  148. top erection pills buy ed drugs online buy ed pills

    Reply
  149. Hey, thanks for the article.Thanks Again. Keep writing.

    Reply
  150. Major thanks for the article post.Thanks Again. Fantastic.

    Reply
  151. Really appreciate you sharing this blog. Really Cool.

    Reply
  152. terima kasih telah berbagi berita Mas, senang sekali rasanya membaca tulisan2 di blog ini, saya merasa bertambah wawasan semoga selalu di beri kesehatan dan sukses selalu..

    Reply
  153. is ed reversible ed clinic male dysfunction treatment

    Reply
  154. Really appreciate you sharing this blog.Really looking forward to read more. Really Cool.

    Reply
  155. clomid without rx generic clomid otc where can i purchase clomid over the counter

    Reply
  156. Im obliged for the article.Much thanks again. Keep writing.

    Reply
  157. cialis 10mg cheap – buy viagra pill sildenafil for women

    Reply
  158. Very nice article, exactly whwt I was looking for.

    Have a look at my webpage; 야짤사이트

    Reply
  159. I really like and appreciate your blog article.Really looking forward to read more. Great.

    Reply
  160. premarin 0 625 bula premarin cost premarin iv

    Reply
  161. online canadian drugstore ed dysfunction treatment buy prescription drugs online

    Reply
  162. provigil order online – order provigil pills order sildenafil 150mg

    Reply
  163. [url=https://premarin.top/]why is premarin so expensive[/url]

    Reply
  164. Hey, thanks for the article. Fantastic.

    Reply
  165. best online drugstore natural help for ed prescription without a doctor’s prescription

    Reply
  166. medicine erectile dysfunction – prednisone 20mg without prescription buy prednisone 20mg pill

    Reply
  167. Really appreciate you sharing this blog article.Much thanks again. Really Great.

    Reply
  168. Thanks so much for the post.Really thank you! Will read on…

    Reply
  169. I really liked your article.Thanks Again. Want more.

    Reply
  170. accutane 10mg us – order amoxicillin 250mg pill order celecoxib 100mg sale

    Reply
  171. Very informative post.Much thanks again. Really Cool.

    Reply
  172. best ed medications buy ed pills online best price for generic viagra on the internet

    Reply
  173. Enjoyed every bit of your article post.Much thanks again. Want more.

    Reply
  174. order generic flomax – order spironolactone online cheap buy spironolactone 25mg without prescription

    Reply
  175. zocor 10mg price – valacyclovir over the counter how to write an essay about my life

    Reply
  176. natural remedies for ed viagra without doctor prescription discount prescription drugs

    Reply
  177. slot games online – assignment writing services academic writing terms

    Reply
  178. Really appreciate you sharing this article.Thanks Again. Will read on…

    Reply
  179. Muchos Gracias for your article.Really looking forward to read more. Great.

    Reply
  180. online casino slots no download – purchase propecia pill order ampicillin for sale

    Reply
  181. Appreciate you sharing, great blog article.Thanks Again. Want more.

    Reply