Marc Swanson wrote:

> In my code I have a few places where I use mysql_pconnect to open a
> persistant database connection to mysql in order to reduce overhead.  I
> also use mysql_insert_id to fetch insert ids for various insert commands.
> Since mysql_pconnect uses the SAME database connection between my php
> scripts... is it concievable that a call to mysql_insert_id COULD return
> the
> id of another insert call if one is happening at that exact moment?


The connection is tied to the Apache process as well as the 
username/password used in the pconnect, so what *REALLY* happens is each 
Apache process ends up with its own connection.

Be sure you have /etc/my.cnf set up so MySQL has *more* connections 
available than /usr/local/apache/conf/httpd.conf has maximum children.

Otherwise, some Apache children will be refused connections, and your site 
will break when load increases.

>  Or am
> I
> worrying about nothing?  If this IS a problem I'll be sure to change my
> code to open a new database connection before calling mysql_insert_id.

Like music?

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to