On Monday 13 January 2003 13:50, Richard Brenner wrote:
> I use an application where users can post messages. The messages are stored
> in two tables that are related by the id of the new created message. I get
> the last id with the following query: "select max(id) as maxid from
> tasker_app"
> The forum has many users and sometimes it happens that there are multiple
> inserts before I can receive the last id.
> Is it possible to stop inserts until I have finished both inserts?
1. You can lock table with LOCK TABLES statement:
http://www.mysql.com/doc/en/LOCK_TABLES.html
2. You can use auto_increment column and LAST_INSERT_ID() function to retrieve
last inserted value from the thread:
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Egor Egorov
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php