What should print_r with a PDO statement in PHP return?

Turrete

New Member
\[code\]$dbh = new PDO ("sqlite:/Library/WebServer/Documents/nwind2009.db3");$sql = "SELECT * FROM Customers"; print_r($dbh->query($sql));\[/code\]This returns:PDOStatement Object ( [queryString] => SELECT * FROM Customers )but if I do:\[code\] foreach ($dbh->query($sql) as $row) { echo $row['CompanyName']; }\[/code\]I get the data.Why doesn't print_r show the database results? What special thing is happening in the foreach? I thought print_r showed me the array and that that was what I was doing in my foreach.Thanks.
 
Back
Top