Many php scripts/people, one mysql user - looming problems?
| From: | nik | Date: | Sat, 11 Aug 2001 17:55:18 +0000 |
| Subject: | Many php scripts/people, one mysql user - looming problems? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11248@lists.php.net to get a copy of this message | ||
Hi:
I'm building a php/mysql app, in which all site visitors access the db via
the same connection script, which connects to the db as user 'root'. This
means that all db connections from the pages will have the same link
identifier.
As long as there are only a few people accessing it, not very concurrently,
this should be fine. But when more users come along, I'm worried about 2
things:
1: if there's a high volume of connections, is there a possibility that the
following..
$result=mysql_query("UPDATE mytable VALUES field1='$data1', field2='$data2'
WHERE field3='$data3'");
$affectedrows=mysql_affected_rows();
...might give the wrong result because some other script (accessed by some
other person) queried the mysql engine in between the execution of these two
lines of code?
2: if one query is executing, and another is triggered on the same link
identifier before the first query finishes, will the second query be queued
and executed sensibly, or will it generate an error?
Thanks for any advice - it's rather hard to test this on my own!
Nik