Subject Re: [firebird-php] auto increment last insert
Author Milan Babuskov
Nigel Weeks wrote:
> // in php4, run a query to get the next value of the generator
> $gensql = "SELECT GEN_ID(gen_tbl_test,1) AS NEW_ID from rdb\$database";
> /* Notes:
> * I renamed the result as NEW_ID so it's easier to see amongst the rest of
> the code
> * Also, remember to escape the $ in the rdb/$database - otherwise PHP will
> think it's a variable
> */

Or just simply use the single-quotes:

$gensql = 'SELECT GEN_ID(gen_tbl_test,1) AS NEW_ID from rdb$database';

> If you remove all the comments, it's about 6 lines of code.

Yep, nice clean and concise.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org