So if I have a custom function with a DB query within template.php such as
function innovista_get_page_children() {
$result = db_query("SELECT link_path FROM {menu_links}");
return $result;
}
and I have a content type specific template page, then how do I echo the results in the template file?
I tried this:
<?php
$results = innovista_get_page_children();
foreach($results as $result){
print $result;
}
?>
I get the following error
Recoverable fatal error: Object of class stdClass could not be converted to string in include() (line 83 of /var/www/vhosts/vidanlawnes.co.uk/innovista2/sites/all/themes/innovista/node--level_1.tpl.php).
If I remove print $result; and replace with print 'hello'... e.g
<?php
$results = innovista_get_page_children();
foreach($results as $result){
//print $result;
print 'hello ';
}
?>
It echoes hello out multiple times, so the query is providing results, but I can't seem to print them as $result. Any ideas?
Thanks for your time