note 72537 added to function.pdo-query

From: Date: Tue, 23 Jan 2007 20:03:41 +0000
Subject: note 72537 added to function.pdo-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-122080@lists.php.net to get a copy of this message
@ dozoyousan at gmail dot com > 03-May-2006 05:26 > > When query() fails, the boolean false is returned. > > I think that is "Silent Mode". > If that set attribute ErrorMode "Exception Mode" > then that throw PDOException. > $pdoObj = new PDO( $dsn, $user, $pass ); > $pdoObj->setAttribute("PDO::ATTR_ERRMODE", > PDO::ERRMODE_EXCEPTION); What you say is correct, however, your PHP code is incorrect: <?php // This is fine $pdoObj = new PDO( $dsn, $user, $pass ); // This line is wrong $pdoObj->setAttribute("PDO::ATTR_ERRMODE", PDO::ERRMODE_EXCEPTION); // It should be: $pdoObj->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Parameter 1 should not be in quotes. PHP interprets // that as a string. Instead, internally, its represented // as type LONG INT. Try it :) ?> Hope this helps. Cheers. ---- Server IP: 216.194.113.175 Probable Submitter: 198.99.24.125 (proxied: 1.1 URSAMAJOR) ---- Manual Page -- http://www.php.net/manual/en/function.pdo-query.php Edit -- https://master.php.net/note/edit/72537 Del: integrated -- https://master.php.net/note/delete/72537/integrated Del: useless -- https://master.php.net/note/delete/72537/useless Del: bad code -- https://master.php.net/note/delete/72537/bad+code Del: spam -- https://master.php.net/note/delete/72537/spam Del: non-english -- https://master.php.net/note/delete/72537/non-english Del: in docs -- https://master.php.net/note/delete/72537/in+docs Del: other reasons-- https://master.php.net/note/delete/72537 Reject -- https://master.php.net/note/reject/72537 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122080) next »