Adding a seperate sql query using addtional table in same database.
Posted: Sat Sep 08, 2007 4:19 pm
I'm trying to pull a category list from the same database and I keep receiving an error.
Here is what my smarty tag says:
global $gCms;
global $db;
$vars = $gCms->variables;
$q= "SELECT zen_categories_name FROM zen_categories_description ASC";
$dbresult = $db->Execute($q);
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
if ($dbresult > 0) {
$row = $dbresult->FetchRow();
echo $row['categories_name'];
}
This is the error I'm getting:
Fatal error: Call to a member function on a non-object in /usr/home/sites/XXXXXXXXXXXXXXXXX/web/lib/content.functions.php(669) : eval()'d code on line 7
Now matter how I change the sql etc.
Hope someone can help.
I need to be able to do this in a few different sites.
Thanks in advance.
Kim
Here is what my smarty tag says:
global $gCms;
global $db;
$vars = $gCms->variables;
$q= "SELECT zen_categories_name FROM zen_categories_description ASC";
$dbresult = $db->Execute($q);
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
if ($dbresult > 0) {
$row = $dbresult->FetchRow();
echo $row['categories_name'];
}
This is the error I'm getting:
Fatal error: Call to a member function on a non-object in /usr/home/sites/XXXXXXXXXXXXXXXXX/web/lib/content.functions.php(669) : eval()'d code on line 7
Now matter how I change the sql etc.
Hope someone can help.
I need to be able to do this in a few different sites.
Thanks in advance.
Kim