lucky3809 Posted October 6, 2014 Share Posted October 6, 2014 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... Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted October 6, 2014 Share Posted October 6, 2014 (edited) 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 October 6, 2014 by KyleMassacre Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted October 6, 2014 Author Share Posted October 6, 2014 Thank you Kyle, I wasn't even thinking about that, the page helped what I was trying to do!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.