note 117892 added to ref.pdo-sqlite

From: Date: Thu, 27 Aug 2015 11:08:22 +0000
Subject: note 117892 added to ref.pdo-sqlite
Groups: php.notes 
Request: Send a blank email to php-notes+get-203487@lists.php.net to get a copy of this message
Note that when you run <?php // open database here... $result = $db->query("select * from table_name;"); var_dump($result); ?> You only get something like this as an output: object(PDOStatement)#3 (1) { ["queryString"]=> string(28) "select * from table_name;" } You need to run a foreach loop over $result in order to see what the query has returned like so: <?php foreach ($result as $item) { var_dump($item); } ?> Only then will you see the result of the query. This caught me out and I thought that the my query didn't return anything, when it actually did. ---- Server IP: 72.52.91.14 Probable Submitter: 83.100.151.189 ---- Manual Page -- http://php.net/manual/en/ref.pdo-sqlite.php Edit -- https://master.php.net/note/edit/117892 Del: integrated -- https://master.php.net/note/delete/117892/integrated Del: useless -- https://master.php.net/note/delete/117892/useless Del: bad code -- https://master.php.net/note/delete/117892/bad+code Del: spam -- https://master.php.net/note/delete/117892/spam Del: non-english -- https://master.php.net/note/delete/117892/non-english Del: in docs -- https://master.php.net/note/delete/117892/in+docs Del: other reasons-- https://master.php.net/note/delete/117892 Reject -- https://master.php.net/note/reject/117892 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203487) next »