Re: Displaying results either side of an Query?

From: Date: Thu, 12 Oct 2000 20:45:45 +0000
Subject: Re: Displaying results either side of an Query?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19924@lists.php.net to get a copy of this message
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. John On Fri, 13 Oct 2000, Joseph H Blythe wrote: > > 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 > > > > > > -- John Donagher Application Engineer Intacct Corp. - Powerful Accounting on the Web 408-395-0989 720 University Ave. Los Gatos CA 95032 www.intacct.com -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: For info see http://www.gnupg.org mQGiBDnCZ1oRBACFgkFCV6p3dWic1qm1FLhip5beIyzZSt+ccTDYQQdPZA/t5H+k PZ7ZFBIUrXz/oEqwQwlEKlg8JQqg7hgtcL+xrIJ0BInLeSJG4lvvB551g59Thr7/ OsdxNVxKci775+K+GkdAz4xcULMuB+QE7t665Ri46EAS8ALos5UG6DGmhwCguD0v 1cxwy/KlKr+oi4sWM9caueED/RmjiSD3vmBZQt6PMisVe1AmkEf6cJoemduCSJxu 0eMz/LIeu+CqfpuJH2N/dZ3hRj9xMSHF4l71wKqV99zhm58kDGwG1u3yVzULPDqz 0yL+8nunlkoOUyn3zOnh3Zmz4POFVMZQ5oian3QkLllUwly5JCi5tWULxZ2vOkb0 zzjuA/4jigNxYV4NAyCl+wAbnyzk9/Iz8EHv4/0Ex8ytlcMtvBJKa9HjJxlyIl74 yOILHk3+GSAdM0b3ZmbavpoCpebinOMBhqEVBwCI4VUIAqf86gx+2dKBGxfKPnU4 Xxvqs/BOl/EbeJjyd4uieYndGRaWg+kYXqZ7SxrlFN24fohnd7QgSm9obiBEb25h Z2hlciA8am9obkB3ZWJtZXRhLmNvbT6IVgQTEQIAFgUCOcJnWgQLCgQDAxUDAgMW AgECF4AACgkQIt6tVu6+jd3SHwCgjssFktMXf8NjE9JBR+sJ2gDIsW8An0CFNdFd dU+DJYC6ogYP9AsVfM27uQENBDnCZ2MQBAD8E0qe1gBKjtoRmyiyORtwhOz/2XZE mqiZN2NouAUWRRZd4dHggFAA1jUsp2MVIZZQyY9ajNVy3Oaxj5kYz8LR5GItxxcD jC8RFXKM40ZfTJeR7fH6eJa689w+le71Tt4ALyN4xcjSWuksr8795AhHFjonDi8D rgGIq6GtWvi/KwADBgQAmeBbcjPzhqR2M8TdvEyNfVTQSSp/RNoTjNNWpHui8V0p kiQ49tbsqeMjXGToGgMugfmrX77JidXyuVjgYjT9xUdaaA25qKAR75M9izDliT7Y h5L+QZTAw0/5X9go7XK3WI3LYfFrp4TP0veXgSWxDqccqsRzWKW7IoXsliTCbVqI RgQYEQIABgUCOcJnYwAKCRAi3q1W7r6N3YIcAKCkJMTPLu6tOPnXPl2s3xmnSawy BACeOx83WlBhVScYWo+BUzntJ6ks4T0= =OkJU -----END PGP PUBLIC KEY BLOCK-----

« previous php.general (#19924) next »