|
Posted by Jim Carlock on 06/15/07 22:42
The above page presents the following information...
Example 1695. Handling connection errors
<?php
$DBName = "sqlite:db.sq3";
$user = "admin";
$pass = "admin";
try {
$dbh = new PDO($DBName, $user, $pass);
$dbh->exec('CREATE TABLE FOO(id INDEX PRIMARY KEY, name TEXT);');
$dbh = null; // Error or warning. This is the only line I didn't change.
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
The $dbh = null; line coughs up an error. That's one of the only lines I
did not change from the example presented on that page. It appears
that the documentation is incorrect. Is that correct?
The code runs, but I'm left confused about why that line exists.
Could one use unset($dbh); to kill it? What's the recommended way
to destroy a PDO object?
Thanks.
--
Jim Carlock
Navigation:
[Reply to this message]
|