note 117892 deleted from ref.pdo-sqlite by googleguy
| From: | googleguy@php.net | Date: | Thu, 27 Aug 2015 11:35:52 +0000 |
| Subject: | note 117892 deleted from ref.pdo-sqlite by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203488@lists.php.net to get a copy of this message | ||
Note Submitter: feedback at starbeamrainbowlabs dot com
----
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.