Is persistent connection + MySQL + Apache + insert_id === safe?

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

 



Hi there,

I suspect you out there know the answer to this one...

If you have a MySQL db on Apache with mod php and you are using php with a
persistent connection, what happens when two people hit your webserver at
the same time? In particular, if the page runs an insert query on a table
with an auto_increment field what can happen to insert_id?

If you do the Insert and then immediately call insert_id, are you guaranteed
to get the relevant insert_id result? Or is it possible for the other page
(call it person_page_2) to get some execution time on the webserver, use the
same persistent connection and insert. If that can happen, then do you get
the right insert_id value back when person_page_1 resumes? Or do you get the
most recent, which would be the insert from person_page_2?

Thanks,

Jeff Veit

http://www.tanasity.com/ - Tanasity develops software and net applications -
radical web update next week - and I've said this for 3 months
http://www.tangledtime.com/ - Occasional blog about the net, software and
business
http://www.chase.org.uk/ - Cambridge Hi-Tech Association of Small
Enterprises - brilliant networking for hi-tech companies around Cambridge,
UK
http://www.chaseconference.org.uk/ - Where Angels Dare and VCs also Tread -
October 10th 2002 - it's happened but I'm very proud of how successful it
was

Tanasity
Mobile: +44 (0)7812 217448
Tel: +44 (0)1223 721499


-- 
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