note 106190 added to pdo.error-handling
| From: | iowamiker at hotmail dot com | Date: | Tue, 18 Oct 2011 04:49:53 +0000 |
| Subject: | note 106190 added to pdo.error-handling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183945@lists.php.net to get a copy of this message | ||
When using
<?php
$dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
to enable exception handling, PDO will sometimes emit a warning, even though PDO::ERRMODE_EXCEPTION.
In the following example, the statement $stmt->execute($sql) will emit a PDO Warning message:
<?php
$dbconn = new PDO(...);
$dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$myvalue="example";
$sql = "SELECT * FROM mytable WHERE mycol=:mycol";
$stmt = $dbconn->prepare($sql);
$res=$stmt->bindParam(':mycol, $myvalue);
$b = $stmt->execute($sql);
?>
----
Server IP: 192.41.42.26
Probable Submitter: 67.191.6.226
----
Manual Page -- http://www.php.net/manual/en/pdo.error-handling.php
Edit -- https://master.php.net/note/edit/106190
Del: integrated -- https://master.php.net/note/delete/106190/integrated
Del: useless -- https://master.php.net/note/delete/106190/useless
Del: bad code -- https://master.php.net/note/delete/106190/bad+code
Del: spam -- https://master.php.net/note/delete/106190/spam
Del: non-english -- https://master.php.net/note/delete/106190/non-english
Del: in docs -- https://master.php.net/note/delete/106190/in+docs
Del: other reasons-- https://master.php.net/note/delete/106190
Reject -- https://master.php.net/note/reject/106190
Search -- https://master.php.net/manage/user-notes.php