Jump to content

Row Position in Database


Mutley

Recommended Posts

I'm wanting to find and echo the row position in a table when they are put into order and there is a certain where clause.

 

For example, I want to find what row position it is where ID = 7... ordered by `joindate`.

 

This might bring up 10 results, where the row with the above ID (7) is 5th in the results. How do I echo "5"?

 

I hope that makes sense.  :D Thanks, Nick.

Link to comment
Share on other sites

It's for a Leaderboard. They have a number assigned to their position but this isn't stored in a database, it's simply by looping a count (e.g. $count = 0; $count++) when the results are displayed.

 

When a certain event happens I want this number to be stored in the database but the file the event in isn't linked to this Leaderboard, so I can't pass the $count over in anyway (like POST/GET or whatever). :)

 

Thanks,

Nick.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.