note 74375 added to function.mysql-connect
| From: | jslakva at gmail dot com | Date: | Sun, 08 Apr 2007 13:05:37 +0000 |
| Subject: | note 74375 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125218@lists.php.net to get a copy of this message | ||
if between first and second call with same arguments there was another call with another argument,
initial connection link is not reused, but new connection is created instead, regardless of new_link
argument.
for example, here only one single link will be opened and then reused:
<?php
$link1 = mysql_connect("localhost");
$link2 = mysql_connect("localhost");
?>
and here _three_ separate links will be opened:
<?php
$link1 = mysql_connect("localhost");
$link3 = mysql_connect("127.0.0.1");
$link2 = mysql_connect("localhost");
?>
so if you wanted to switch between connections just by call to mysql_connect, and rely on its
internal link caching, you can be wasting your database connections.
----
Server IP: 69.147.83.197
Probable Submitter: 91.124.166.20
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- https://master.php.net/note/edit/74375
Del: integrated -- https://master.php.net/note/delete/74375/integrated
Del: useless -- https://master.php.net/note/delete/74375/useless
Del: bad code -- https://master.php.net/note/delete/74375/bad+code
Del: spam -- https://master.php.net/note/delete/74375/spam
Del: non-english -- https://master.php.net/note/delete/74375/non-english
Del: in docs -- https://master.php.net/note/delete/74375/in+docs
Del: other reasons-- https://master.php.net/note/delete/74375
Reject -- https://master.php.net/note/reject/74375
Search -- https://master.php.net/manage/user-notes.php