Re: Displaying results either side of an Query?
| From: | Joseph H Blythe | Date: | Fri, 13 Oct 2000 01:12:12 +0000 |
| Subject: | Re: Displaying results either side of an Query? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19936@lists.php.net to get a copy of this message | ||
John Donagher wrote:
> Joseph-
>
> If I understand correctly, what you want to do is this:
>
> 1) select id, myrank from the_table where name='myname', and set that id in
> $some_id_var, and set the rank in $some_rank_var in your script.
> 2) then, select * from the_table where rank BETWEEN ($some_rank_var-15) and ($some_rank_var+15)
> order by rank
> 3) in the code, just loop through your result set, and when the id of the row you are at
> matches $some_id_var, you do whatever special formatting you want to let the person know that that
> row is their row
>
> That's just an abstract description of how you could program this. The code itself
> isn't too complex. If you're using mysql, you cannot do subselects (last time I tried,
> anyway) so this has to be two seperate queries.
Thanks John,
This makes sense I will give it a whirl this afternoon and will keep you all informed.
Regards
Joseph