A little cumbersome maybe, but it does the trick (using Lock):

<cfquery datasource="your_datasource" name="lockThreads">
LOCK TABLES yourTableName WRITE
</cfquery>
 
<cfquery datasource="your_datasource">
INSERT INTO yourTable (yourFields)
VALUES (yourValues)
</cfquery>

<cfquery datasource="your_datasource" name="lastMID">
 SELECT LAST_INSERT_ID() AS msgID
 FROM yourTable
</cfquery>
 
<cfquery datasource="pheads_User" name="unlockThreads">
 UNLOCK TABLES
</cfquery> 



Hope this helps!
Tage Widsell
Webmaster
Propellerhead Software


----------
>From: "Adam Reynolds" <[EMAIL PROTECTED]>
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: RE: OT: MYSQL
>Date: ons 6 dec 2000 12.41
>

>
>
> Anybody have experience with this DB?
>
> In particular I'm attempting to insert a new item into a table and
> retrieve the item_id which is defined as an autonumber.
>
> Is there a way of getting this information in MySQL. The other option is
> to create a id table and create a next_id function, but as MySQL does not
> support database transactions and I'm unfamiliar with the intracacies of
> MySQL, I'm curious what people do. I had considered using the LOCK
> command, but I'd prefer an atomic action, rather than locking of the table
> in such a fashion.
>
> Best Regards,
>
> Adam Reynolds
> ColdFusion Web Developer
> ISMG Development, Unilever
> London
>
> ( +44 20 7822 x5450
> m: +44 7973 386620
> *  [EMAIL PROTECTED]
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists