RE: [PHP-DB] help me on projecting some tables
| From: | Paul DuBois | Date: | Fri, 23 Nov 2001 20:26:48 +0000 |
| Subject: | RE: [PHP-DB] help me on projecting some tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14562@lists.php.net to get a copy of this message | ||
At 9:41 AM -0600 11/16/01, Tim Foster wrote:
A couple of questions:Yes.INSERT INTO traits VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");1. Will LAST_INSERT_ID() work reliably in a multi-user environment?
What happens if you're in the middle of inserting a dozen records and someone else inserts a record? Does MySQL keep the LAST_INSERT_ID()s separate (since the web application will see both transactions as being done by the same "user")?Doesn't matter if it's the same user. What's important is that these operations will be done over separate client connections to the MySQL server. LAST_INSERT_ID() is maintained on a connection-specific basis, so it doesn't matter if someone else is inserting records at the same time. You won't get their insert ID, nor they yours. It works as you want.