you could recreate the random_id daily or more frequently if required,
depends how important it is for ever one to have a new order.

Passing 200 id's around in a session for each person, doesn't sound to
bad, wouldn't want to do it with 2 million!

On Dec 2, 1:03 pm, David Turton
<[EMAIL PROTECTED]> wrote:
> Thanks Sid, I can't see why that wouldn't work.
> Now, off to the weekly production meeting yay! (I mean yawn)
> Cheers
> Dave T
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Sid 
> Bachtiar
> Sent: Tuesday, 2 December 2008 12:56 p.m.
> To: [email protected]
> Subject: [phpug] Re: randomised resultset and pagination best practice?
>
> This is just something on top of my head. I never tried this and have
> not put a lot of thought into it.
>
> How bout adding a varchar(255). For every new record, fill it with a
> randomize string. Then whenever you want to start a resultset, pick a
> random number between 1-255 and order the set based on that random
> number? So if random number is 5, sort the set based on the 5th
> character.
>
> On Tue, Dec 2, 2008 at 12:48 PM, David Turton
> <[EMAIL PROTECTED]> wrote:
>
> > Sounds like an option, but I want each new result set to be random, not 
> > just starting from a different point. I can't off the top of my head see 
> > how that would do it.
> > Dave T
>
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Boyd
> > Sent: Tuesday, 2 December 2008 12:36 p.m.
> > To: NZ PHP Users Group
> > Subject: [phpug] Re: randomised resultset and pagination best practice?
>
> > how about creating a random_id col for the db, every time you add a
> > record add a random number rand(0,1000000); then sort on that, and
> > index that col.
>
> > On Dec 2, 12:01 pm, David Turton
> > <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >> I have a result set of 200+ records, paginated in blocks of 10 e.g. 20+ 
> >> pages
> >> I need to randomize the result set (no problem), but I can't find which is 
> >> the best way of storing the result in its randomized order.
> >> I'm looking for best practice that uses the least memory/processing, etc.
> >> Suggestions?
> >> Thanks
> >> Dave T
>
> >> ________________________________
> >> Warning: This email contains information which is CONFIDENTIAL and may 
> >> also be LEGALLY PRIVILEGED. If you are not the intended recipient you must 
> >> not peruse, use, disseminate, distribute or copy this email or 
> >> attachments. If you have received this in error, please notify us 
> >> immediately by return email and delete this email.
> >> Thank you.
>
> >> #####################################################################################
> >> This e-mail message has been scanned for Viruses and Content and cleared
> >> by MailMarshal
> >> #####################################################################################
>
> > Warning: This email contains information which is CONFIDENTIAL and may also 
> > be LEGALLY PRIVILEGED.  If you are not the intended recipient you must not  
> > peruse, use, disseminate, distribute or copy this email or attachments.  If 
> > you have received this in error, please notify us immediately by return 
> > email and delete this email.
> > Thank you.
> > #####################################################################################
> > This e-mail message has been scanned for Viruses and Content and cleared
> > by MailMarshal
> > #####################################################################################
>
> Warning: This email contains information which is CONFIDENTIAL and may also 
> be LEGALLY PRIVILEGED.  If you are not the intended recipient you must not  
> peruse, use, disseminate, distribute or copy this email or attachments.  If 
> you have received this in error, please notify us immediately by return email 
> and delete this email.
> Thank you.
> #####################################################################################
> This e-mail message has been scanned for Viruses and Content and cleared
> by MailMarshal
> #####################################################################################
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to