php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10032 mysql_connect not making a new connection each time it is called
Submitted: 2001-03-27 17:21 UTC Modified: 2002-07-22 02:38 UTC
From: kwatt at buybuddy dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: red hat linux
Private report: No CVE-ID: None
 [2001-03-27 17:21 UTC] kwatt at buybuddy dot com
In the documentation, it says that one way mysql_pconnect and mysql_connect is that in pconnect, it opens a new connection only if there is not one open to the same host,username,password tuple.  However, mysql_connect does the same thing.

The thing I find annoying about the fact that mysql_connect not automatically opening a new connection is that there are some functions that change the attributes of a connection overall.  When you call mysql_select_db on a connection, you are changing the database for every instance that is referencing that same connection.  There is no way to make one connection that refers to one database, and one that refers to another.

Really, there should be two mysql_connect functions:  

1) mysql_new_connect 

and 

2) mysql_connect

mysql_new_connect would make a new connection to the database no matter what.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-22 02:38 UTC] georg@php.net
Since PHP 4.2.0 you can use the optional parameter new_link, to create a new connection with mysql_connect.

See http://www.php.net/manual/en/function.mysql-connect.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 16:01:30 2025 UTC