MySQL Next Autoindex
I need to get the next autoindex of a table called 'threads' froma database called 'message_board'.
I've asked around, and no one seems to be able to give me a good answer, any help would be appreciated.
[ FinalCreations ]
I need to get the next autoindex of a table called 'threads' froma database called 'message_board'.
I've asked around, and no one seems to be able to give me a good answer, any help would be appreciated.
[ FinalCreations ]
Mark Hensler posted this at 00:52 — 21st November 2002.
He has: 4,048 posts
Joined: Aug 2000
try this:
SHOW TABLE STATUS FROM `message_board` LIKE 'threads';
this will return a list of fields including Auto_increment, which contains the value of the next auto_increment value.
mySQL Docs:
4.5.6.2 SHOW TABLE STATUS
Mark Hensler
If there is no answer on Google, then there is no question.
FinalMjolnir666 posted this at 01:27 — 21st November 2002.
They have: 45 posts
Joined: Feb 2002
Ah okay, thanks.
I heard that that might not be a very safe way to do things on something user intensive like a forum, because if two people request things right after another, they might get the same things, and then post things with the same thing... and... well... it's tough to explain.
Is this a safe way of doing things that you know of?
[ FinalCreations ]
Mark Hensler posted this at 06:01 — 21st November 2002.
He has: 4,048 posts
Joined: Aug 2000
Why do you want the next auto_increment number?
What do you plan on doing with it?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.