|
Posted by Richard Lynch on 05/09/05 04:45
Check the MySQL manual for how to order randomly.
They might have a way to do it.
However...
If there are a fairly number of consistent plans in each company, you
might be better off with something that just chooses N companies at
random, enough to fill a page, and that's it.
One wrinkle is this: If user X goes forward a page, can they see the same
company again, or does the order need to be fixed after they see page 1?
If it must be fixed, I think you'd be best served with making a @TEMP
table in MySQL and then assigning each company ID a random place in it,
and using that as your ordering for company IDs.
On Sat, May 7, 2005 5:52 am, Ryan A said:
> 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.
>
>
> To see the code used presently (stripped down to a few lines) :
> http://jappz.com/testing.phpp
>
> To see the output from the above :
> http://jappz.com/testing.html
>
>
> Any suggestions, classes, code, links or general help would be
> appreciated.
>
> Thanks,
> Ryan
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|