[PHP-DB] how obtain last id past insert?
Hi: How i obtain inmediatly the id of last insert ? For example i have a forum, when the user post a question, i send a mail to administrator, but i want to refer the id from this insert, how i do this ? Well i think to make a select max(id) inmediatly but i beliebe that must have any colision from other user that post other question. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how obtain last id past insert?
if you're using mysql php.net/mysql_insert_id if you're not, there may be a variant for you db hth Jeff Webmaster D.G.R.E.R. To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: ios.gov.ar Subject: [PHP-DB] how obtain last id past insert? 11/20/2003 02:52 PM Hi: How i obtain inmediatly the id of last insert ? For example i have a forum, when the user post a question, i send a mail to administrator, but i want to refer the id from this insert, how i do this ? Well i think to make a select max(id) inmediatly but i beliebe that must have any colision from other user that post other question. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how obtain last id past insert?
Webmaster D.G.R.E.R. wrote: Hi: How i obtain inmediatly the id of last insert ? For example i have a forum, when the user post a question, i send a mail to administrator, but i want to refer the id from this insert, how i do this ? Well i think to make a select max(id) inmediatly but i beliebe that must have any colision from other user that post other question. What database are you using? You may be able to use mysql_insert_id() or SELECT @@IDENTITY depending upon your DB... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how obtain last id past insert?
depends which DB your using in mysql its select last_insert_id() and in mssql for example its select @identity have fun Pete Webmaster D.G.R.E.R. wrote: Hi: How i obtain inmediatly the id of last insert ? For example i have a forum, when the user post a question, i send a mail to administrator, but i want to refer the id from this insert, how i do this ? Well i think to make a select max(id) inmediatly but i beliebe that must have any colision from other user that post other question. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php