Re: mysql_insert_id() vs. last_insert_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I've been checking the last_insert_id() function out and I am curious. The
> MySQL docs say to use the mysql_insert_id() function after an "insert
into"
> query to grab the key value. Both seem to work; however, there are some
> subtle differences.
>
> Which is the best one to use after a single insert statement, or does it
> matter?

It really doesn't matter. If you need the number in PHP for something else,
then use the PHP function. If you just need it for another query, one right
after the other, then use the MySQL function and don't worry about PHP
retrieving it.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux