GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Feb-2006, 23:44
Snapple Snapple is offline
New Member
 
Join Date: Jun 2005
Posts: 16
Snapple is on a distinguished road
Question

How do I start a list in the middle?


Let's just say I have a list of 85 users in my database. Each user is ranked 1-9 randomly*. I want the viewer to see his name right in the middle of 15 other people around his status. Right now I have it where it lists 15 people, starting with the highest ranked, and you are able to click from page to page to see everyone, there are 6 pages totaly... fyi.

if nothing else, sign up at my game and go to "List of players" to see what I mean. http://www.mysticcrusade.com

*Actually it's their level in a game where no one has passed level 9 yet.
  #2  
Old 24-Feb-2006, 00:32
Kilgayne's Avatar
Kilgayne Kilgayne is offline
Junior Member
 
Join Date: Jun 2004
Location: somewhere
Posts: 52
Kilgayne is on a distinguished road

Re: How do I start a list in the middle?


Could you please explain what you mean by "seeing his name right in the middle of 15 other people around his status"?
  #3  
Old 24-Feb-2006, 16:18
celebkuki celebkuki is offline
New Member
 
Join Date: Feb 2006
Posts: 2
celebkuki is on a distinguished road
Post

Re: How do I start a list in the middle?


there are alot of ways you can do it.
you can make two queries, first query take the member position and second query use first query position to select 7 lines from before and after the member position.

second way of doing this is inserting all selected rows into an array, then use for() loop.
example:

PHP Code:

//place of member
$a=15;

//array created from db with users order by their placment
//multi array could be better, depend on your data
$position = array('sdsd','dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd','dgdfgd','dgdfgd','dgdfgd',
                        'dgdfgd')
;

//using for loop to show details
for ($i=$a-7;$i<$a+8;$i++){
    if ($i == $a) {
        echo "<b>".$i."</b> ".$position[$i]."<br>\n";
    }
    else {
    echo $i." ".$position[$i]."<br>\n";
    }
} 



hope this help you
good luck...
  #4  
Old 25-Feb-2006, 19:24
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about

Re: How do I start a list in the middle?


I kind of like the way your list is now.

I noticed the "Show All" feature doesn't really show everyone.
 
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent ! Pls Help Me ! mycashmoney C Programming Language 4 01-Jul-2006 22:49
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
linked list error message Krandygrl00 CPP / C++ Forum 4 22-Jun-2005 14:13
search linked list itsmecathys CPP / C++ Forum 20 18-Apr-2005 01:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:13.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.