Jump to content
MakeWebGames

Help with selection


lucky3809

Recommended Posts

I am trying to figure this out, I am sure if I dig deeper, I will find the way, but first I want to know if anyone else knows how to do this.

I have a select query selecting names, that forms a list of 25

What I want it to do is highlight the two above me and two below me.

such:

Name 1

Name 2

Name 3

Name 4

My Name (5)

Name 6

Name 7

Name 8

Name 9

Name 10

So forth...

Link to comment
Share on other sites

Hmm, never really attempted this before because I never had the need. But what I would attempt is to grab the index number of my name and store that number in a separate variable. So in your example you would be index 4 and say your incrementing your indexes like this for this example: $i++; so when your $i hits your unique id or name or whatever store in cache like $var = $i;. Now you want the 2 indexes before and after your $var marker and format it that way.

you may find some help looking at Fizzbuzz

Edited by KyleMassacre
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...