#29522 [Asn->Csd]: properties of mysqli (class) aren't accessable if db connection already closed
ID: 29522
Updated by: georg@php.net
Reported By: Nico dot Laus dot 2001 at gmx dot de
-Status: Assigned
+Status: Closed
Bug Type: MySQL related
Operating System: Linux 2.6.7
PHP Version: 5.0.0
Assigned To: georg
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-08-04 13:44:30] Nico dot Laus dot 2001 at gmx dot de
Description:
------------
when closing the connection to the db, and using
properties of the $mysqli object (such as insert_id), PHP
crashes (or even the webserver, I don't know)
-> although closing it before is not the right way, at
least an error message should be displayed
(took me a while to recognize that 1. some properties are
not accessible after disconnecting and 2. that this was
the reason for not showing the whole page)
Reproduce code:
---------------
// taken from
http://de2.php.net/manual/en/function.mysqli-insert-id.php
$mysqli = new mysqli('HOST', 'USER', 'PASSWORD','DB');
$mysqli->query("CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU',
'Stuttgart', 617000)";
$mysqli->query($query);
/* close connection */
$mysqli->close();
printf ("New Record has id %d.\n", $mysqli->insert_id);
Expected result:
----------------
print out "New Record has id <id>"
Actual result:
--------------
"connection to <server> broken" error message from the
browser
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29522&edit=1
Thread (3 messages)