Re: Displaying results either side of an Query?
| From: | Joseph H Blythe | Date: | Thu, 12 Oct 2000 22:53:10 +0000 |
| Subject: | Re: Displaying results either side of an Query? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19917@lists.php.net to get a copy of this message | ||
Daniel Convissor wrote:
>
> But what do you want the 15 other, well 30 really, results to be? Is each
> row of this table going to contain the same columns, just showing the data
> from 15 randomly selected records before your choice and after your choice?
>
> If you want random records, keep in mind the MySQL manual says "In MySQL
> 3.23, you can however do: SELECT * FROM table_name ORDER BY RAND()." That
> may be helpful for you. You can even throw on a LIMIT 30.
>
> If I'm understanding you correctly, I'd create two queries, one for the data
> you want and another for the random data. Then, loop through the random data
> in a for loop, when you hit your magic number, spit out your special record,
> then resume with your random data.
>
> Have fun,
Hey Daniel,
Thanks for you reply, I really didn't expalin it very well did I :-)
The results either side of the query would not be random, basically what I am
trying to do is show the placement of a runner in a race, but instead of just
listing all the results, I want to be able to let them type in thier name or a
number and it would display thier placment in the race with x number of results
above and below thier result. For instance if I place 100th and I had set the
max results to 30 then it should display:
Results 85 - 99
*Me 100th*
Results 101 - 114
Or something like that I have seen this sort of thing done with ASP on
www.theclq.com (Champions League for Quake) where if you type in a players name
it will display a page of results with your query highlighted usually in the
middle of the page.
I hope this makes a little more sense.
Regards,
Joseph