Hi,
IMHO:
I think you should try :
1)
    SET @a:=0;
    LOCK TABLE your_table_name WRITE;
    INSERT what_client_must_to_insert
    SELECT @a:=MAX(ID) FROM table....etc
    UNLOCK TABLE;
    After unlock the table you can find the value of variable @a by doing:
    SELECT @a;
2)
    INSERT what_client_must_to_insert
    SELECT LAST_INSERT_ID();

Regards,

Gelu
_____________________________________________________
G.NET SOFTWARE COMPANY

Permanent e-mail address : [EMAIL PROTECTED]
                                          [EMAIL PROTECTED]
----- Original Message -----
From: "Richard Brenner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 13, 2003 1:50 PM
Subject: problem with last_id


> I have a problem with a query:
>
> 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?
>
>
> Thank you,
> Richard Brenner
>
>
>
> ---------------------------------------------------------------------
> 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
>
>


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

Reply via email to