• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

random results and paging

Guest
Sep 12, 2008 Sep 12, 2008

Copy link to clipboard

Copied

Hi guys, I have query which returns random X numbers like:

SELECT field FROM table
ORDER BY NewId()

Now I want to display results in sequence by 2 using "<cfoutput startRow maxRows..>"

problem is when I display first two records and hit next page refresh and I get different query result set (they get randomized again so I am getting a lot of repeated records)

Any idea how to solve this, only thing that is coming to my mind is to cache query in session but... there must be better way.

Thanks
TOPICS
Advanced techniques

Views

224

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2008 Sep 12, 2008

Copy link to clipboard

Copied

What's wrong with making it a session variable? If you are displaying x records per page, you'd have to do something like that anyway.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2008 Sep 12, 2008

Copy link to clipboard

Copied

LATEST
Hi, actually I am displaying always 2 records per page,
storing query result in session is a bit of a problem (CF setting is that session is active for 12 hours), and requirement is: every site entry to show two different items on page with next prev links to scroll two by two.
Everything is working just fine, only this next prev links are giving me problems since query refresh and return different set of records (since it is random) so there are duplicates.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation