Pain Posted May 20, 2013 Share Posted May 20, 2013 Hello there. I am using the PDO wrapper class: http://www.imavex.com/php-pdo-wrapper-class/ The problem: When i'm trying to retrieve data from the db and then echo it out - the result i get is "Array" and not the actual value. What is wrong here, how can i retrieve actual value? The way i'm trying to retrieve and display values: $results = $db->select("mytable"); echo $results; Link to comment https://forums.phpfreaks.com/topic/278221-pdo-wrapper-select-and-display/ Share on other sites More sharing options...
requinix Posted May 20, 2013 Share Posted May 20, 2013 It's an array. You need some sort of loop, like a foreach. Link to comment https://forums.phpfreaks.com/topic/278221-pdo-wrapper-select-and-display/#findComment-1431248 Share on other sites More sharing options...
Pain Posted May 20, 2013 Author Share Posted May 20, 2013 Foreach didn't help. I've tried foreach($results as $m) { echo $m; } and i still get "Array". Link to comment https://forums.phpfreaks.com/topic/278221-pdo-wrapper-select-and-display/#findComment-1431251 Share on other sites More sharing options...
requinix Posted May 20, 2013 Share Posted May 20, 2013 Because $m is also an array. This isn't rocket science. Link to comment https://forums.phpfreaks.com/topic/278221-pdo-wrapper-select-and-display/#findComment-1431268 Share on other sites More sharing options...
DaveyK Posted May 21, 2013 Share Posted May 21, 2013 maybe this will help you understand the structure a little better <?php $results = $db->select("mytable"); echo '<pre>' . print_r($results, true) . '<pre>' ; ?> Its really straightforward. Link to comment https://forums.phpfreaks.com/topic/278221-pdo-wrapper-select-and-display/#findComment-1431315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.