You are here: Re: [PHP] Random but ordered.. « PHP « IT news, forums, messages
Re: [PHP] Random but ordered..

Posted by Marek Kilimajer on 10/19/15 11:15

Ryan A wrote:
> Hey,
>
> I have been screwing around with this code for around a day and am hitting a
> wall, any
> help would be appreciated.
>
>
> Basically, I am working on a site that queries the DB for companies and the
> plans the company
> is offering, the DB is quite big (a few thousand records in each of the 20
> tables)
>
> The parameters are taken from the client in the form of a search box and
> usually gives around 1000 results per query, they results are then displayed
> like this:
>
>
> company 1
> [] plan
> [] plan
> [] plan
> [] plan
> company 2
> [] plan
> [] plan
> [] plan
> company 3
> [] plan
> company 4
> [] plan
> [] plan
>
> So far, no problems (even though the code and the design are mixed together
> in the page)
> but so far the code is getting the results grouping via $cno, which results
> in the lowest being displayed first which gives the first companies who
> joined an edge as they are always getting displayed.
>
>
> Heres the kicker, he wants to have the same display as above....but randomly
> from the DB *while still* having pagination.. so new joined companies too
> get displayed and not shoved at the end of the results.

Choices:

1. ORDER_BY RAND(), and keep the full result set (or just the ids) in
session

2. add another column, display_order, and update it at regular intervals
to random values.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация