Bill, I'm no MySQL expert, but I have some code that accomplishes this and it seems to work just fine. From what I'm seeing in the code I have, it's necessary to issue a "Lock Table [my table] Write" command, then insert your record, and then call Last_Insert_ID. After that you have to use Unlock Tables.
HTH, Chris Sheffield -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Sent: Friday, March 18, 2005 8:18 AM To: How to use Revolution Subject: Re: RunRev crashes when you experiment with database queries I tried that command (which is what you use to find the last insert in the whole database instead of just one table -- the name of the table I'm dealing with is "tripulantes" which means crewmembers) and it also didn't work. The command is behaving very strangely as I can run the query over and over again and it keeps returning a number that it increments by one each time even though no records have been added in the database. On 3/18/05 11:06 AM, "Gordon Tillman" <[EMAIL PROTECTED]> wrote: > Hi Bill, > > On Mar 18, 2005, at 08:58, Bill wrote: > >> I am trying to get the ID number of the last inserted record in a MySQL >> database. Can anyone help me do this? > ... >> put "SELECT LAST_INSERT_ID() from tripulantes" into dbQuery >> put revQueryDatabase(tConnection, dbQuery) into LastInsertID > > I don't know if this is your problem or not, but I just use SELECT > LAST_INSERT_ID() as the entire SQL command, omitting the "from..." > part. I just just my MySQL user manual and I don't see the "from ..." > as being a valid part of the command, unless maybe you are using a > newer version than what I have. > > --gordy > > _______________________________________________ > use-revolution mailing list > use-revolution@lists.runrev.com > http://lists.runrev.com/mailman/listinfo/use-revolution > > | | | )_) )_) )_) )___))___))___)\ )____)____)_____)\\ _____|____|____|____\\\__ -------\ /--------- http://www.bluewatermaritime.com ^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ ^^^^ ^^^ ^^ ^^^^ ^^^ 24 hour cell: (787) 378-6190 fax: (787) 809-8426 Blue Water Maritime P.O. Box 91 Puerto Real, PR 00740 _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005 _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution