Reply to http://us.php.net/manual/en/ref.pdo.php $dbh = null;

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация