Pain Posted May 20, 2013 Share Posted May 20, 2013 (edited) 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; Edited May 20, 2013 by Pain Quote 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. Quote 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". Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.