14.06.2012, 10:47
Quote:
Thanks for the quick response!
Sorry I didn't explain well, basically I just want to add a record when a player registers with basic information such as the player name and IP. And also a Primary Key as the player's ID, so this can act as a 'registered players count' also. So when the player registers, what do I format the query as and what keyword do I use? Edit: Think I figured it out! "INSERT INTO" should create a new row? |
You can then use a SELECT query to get the highest ID to retrieve the count by the method you want:
Код:
SELECT ID from players ORDER BY ID DESC LIMIT 1
Alternatively, you could just use the num_rows function which calculates how many rows there are in the table. If you rely on the "ID" field, deleted accounts won't be considered and will still add to the count.
For that, you can use something like this for your query:
Код:
SELECT COUNT(*) FROM players