how do you get the MySQL mysql_insert_id(); from within Rev?

Trevor DeVore lists at mangomultimedia.com
Fri May 26 11:49:33 EDT 2006


On May 26, 2006, at 1:08 AM, Josh Mellicker wrote:

> Just wondering,
>
> After you execute a revExecuteSQL INSERT, how do you get the auto- 
> incremented record ID MySQL automatically assigned (from within Rev)?
>
> (Rather than doing an inelegant search for the record you just  
> inserted and reading it's ID?)

Try this:

function getLastInsertIDForMySQL pConnID
     put "SELECT LAST_INSERT_ID()" into theSQL
     return revDataFromQuery(,, pConnID, theSQL)
end getLastInsertIDForMySQL


-- 
Trevor DeVore
Blue Mango Learning Systems - http://www.bluemangolearning.com
trevor at bluemangolearning.com





More information about the use-livecode mailing list