Reputation: 157
I am using this PDO wrapper class: http://www.imavex.com/php-pdo-wrapper-class/#select and now just have troubles to echo an object.
This is the method declaration:
<?php
//select Method Declaration
public function select($table, $where="", $bind="", $fields="*") { }
?>
My query goes like this which prints the result array:
<?php
$title = 'title_'.$GLOBALS['SelectedLang'];
$results = $GLOBALS['db']->select("news", $title != '', "", $title);
print_r($results);
?>
But how do I echo one table field of the query? Which in old school mysql I would have done like this:
<?php
$row = @mysql_query($results);
echo $row->$title;
?>
The output for the print_r is: Array ( [0] => Array ( [title_en] => englisch ) )
Upvotes: 0
Views: 1662
Reputation: 2748
So if you want to echo your query results you should do it in a loop:
foreach($results as $r){echo $r['title_en'];}
Upvotes: 4