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 of http://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]

Reply via email to