Thanks David, I had already decided to use Rank instead of Order.

On Dec 1, 10:51 am, David Turton
<[email protected]> wrote:
> Except don't use the word "Order" as a table column name.
> It's a reserved sql word.
> Cheers
> Dave T
>
>
>
> -----Original Message-----
> From: Super Steve [mailto:[email protected]]
> Sent: Tuesday, 1 December 2009 10:49 a.m.
> To: NZ PHP Users Group
> Subject: [phpug] Re: Rotating Items on a Daily Basis?
>
> Hey that sounds like a great way to do it.  Thanks Simon!
>
> On Dec 1, 10:13 am, Simon J Welsh <[email protected]> wrote:
> > One way would be to add a column to the table, say Order, with values from 
> > 1 to max. Then, using a crontab or some such, UPDATE Stores SET Order = 
> > Order - 1; UPDATE Stores Set Order = MAX(Order) + 1 WHERE Order = 0;
>
> > Grab the stores sorted by Order.
>
> > On 1/12/2009, at 10:09 AM, Super Steve wrote:
>
> > > I've got a client that wants to display on his website a list of
> > > retail stores that stock his products.  To facilitate this we have all
> > > of the store details in a MySQL database.
>
> > > But rather than display all of the stores in alphabetical or location
> > > order, my client wants to rotate the stores so each one gets a turn at
> > > being at the top.  The idea is that at the beginning of each day the
> > > store that was on the top yesterday will move to the bottom and all
> > > the other stores move up one.  For the rest of the day the stores are
> > > displayed in this order, i.e they maintain their positions for the
> > > whole day.  Then next day the top one goes to the bottom and they all
> > > move up one.
>
> > > Does anyone have any idea on how I can achieve this?  I'm not looking
> > > for actual PHP code, just pseudo code to get me on the right track.
>
> > > --
> > > NZ PHP Users Group:http://groups.google.com/group/nzphpug
> > > To post, send email to [email protected]
> > > To unsubscribe, send email to
> > > [email protected]
>
> > ---
> > Simon Welsh
> > Admin ofhttp://simon.geek.nz/
>
> > Who said Microsoft never created a bug-free program? The blue screen never, 
> > ever crashes!
>
> >http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
>
> --
> NZ PHP Users Group:http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]
>
> 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