note 106189 added to pdo.error-handling
| From: | iowamiker at hotmail dot com | Date: | Tue, 18 Oct 2011 04:49:39 +0000 |
| Subject: | note 106189 added to pdo.error-handling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183944@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/106189
Del: integrated -- https://master.php.net/note/delete/106189/integrated
Del: useless -- https://master.php.net/note/delete/106189/useless
Del: bad code -- https://master.php.net/note/delete/106189/bad+code
Del: spam -- https://master.php.net/note/delete/106189/spam
Del: non-english -- https://master.php.net/note/delete/106189/non-english
Del: in docs -- https://master.php.net/note/delete/106189/in+docs
Del: other reasons-- https://master.php.net/note/delete/106189
Reject -- https://master.php.net/note/reject/106189
Search -- https://master.php.net/manage/user-notes.php