svn: /phpdoc/en/trunk/reference/pdo/ connections.xml

From: Date: Fri, 01 Jul 2016 09:07:57 +0000
Subject: svn: /phpdoc/en/trunk/reference/pdo/ connections.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14271@lists.php.net to get a copy of this message
cmb Fri, 01 Jul 2016 09:07:57 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=339536 Log: Fix #69730: PDO: incorrect description of how to close the connection to the database Bug: https://bugs.php.net/69730 (Open) PDO: incorrect description of how to close the connection to the database Changed paths: U phpdoc/en/trunk/reference/pdo/connections.xml Modified: phpdoc/en/trunk/reference/pdo/connections.xml =================================================================== --- phpdoc/en/trunk/reference/pdo/connections.xml 2016-06-30 23:45:17 UTC (rev 339535) +++ phpdoc/en/trunk/reference/pdo/connections.xml 2016-07-01 09:07:57 UTC (rev 339536) @@ -65,10 +65,18 @@ is returned to your script. The connection remains active for the lifetime of that PDO object. To close the connection, you need to destroy the object by ensuring that all remaining references to it are - deleted--you do this by assigning &null; to the variable that holds the + deleted—you do this by assigning &null; to the variable that holds the object. If you don't do this explicitly, PHP will automatically close the connection when your script ends. </para> + <note> + <simpara> + If there are still other references to this PDO instance (such as from a + PDOStatement instance, or from other variables referencing the same PDO + instance), these have to be removed also (for instance, by assigning NULL to + the variable that references the PDOStatement). + </simpara> + </note> <para> <example> <title>Closing a connection</title> @@ -77,9 +85,10 @@ <?php $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass); // use the connection here +$sth = $dbh->query('SELECT * FROM foo'); - // and now we're done; close it +$sth = null; $dbh = null; ?> ]]>

« previous php.doc.cvs (#14271) next »