note 75221 added to function.PDO-setAttribute

From: Date: Fri, 18 May 2007 14:59:44 +0000
Subject: note 75221 added to function.PDO-setAttribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-126689@lists.php.net to get a copy of this message
Because no examples are provided, and to alleviate any confusion as a result, the setAttribute() method is invoked like so: setAttribute(ATTRIBUTE, OPTION); So, if I wanted to ensure that the column names returned from a query were returned in the case the database driver returned them (rather than having them returned in all upper case [as is the default on some of the PDO extensions]), I would do the following: <?php // Create a new database connection. $dbConnection = new PDO($dsn, $user, $pass); // Set the case in which to return column_names. $dbConnection->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); ?> Hope this helps some of you who learn by example (as is the case with me). .Colin ---- Server IP: 69.147.83.197 Probable Submitter: 64.207.232.142 (proxied: 1.1 WIN-WEBFILTER) ---- Manual Page -- http://www.php.net/manual/en/function.PDO-setAttribute.php Edit -- https://master.php.net/note/edit/75221 Del: integrated -- https://master.php.net/note/delete/75221/integrated Del: useless -- https://master.php.net/note/delete/75221/useless Del: bad code -- https://master.php.net/note/delete/75221/bad+code Del: spam -- https://master.php.net/note/delete/75221/spam Del: non-english -- https://master.php.net/note/delete/75221/non-english Del: in docs -- https://master.php.net/note/delete/75221/in+docs Del: other reasons-- https://master.php.net/note/delete/75221 Reject -- https://master.php.net/note/reject/75221 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126689) next »