count_news_comments error [solved]
Posted: Mon Jan 08, 2007 4:08 pm
I'm trying to extend the news module for use as a blog. I've followed the wiki etc etc. but there 's a problem with the user defined tag: count_news_comments. I made the tag succesfully and edited the news templates as written in the wiki. When I test the blog I get this error (translated out of Dutch):
DB error: There's something wrong with the used syntax 'AND module_name='News' AND active='1'' on line 3
Fatal error: Call to a member function on a non-object in c:\program files\easyphp1-8\www\blog\lib\content.functions.php(663) : eval()'d code on line 14
I'm running: CMS Made Simple 1.0.2 "Maui", Apache/1.3.33 (Win32) PHP/4.3.10, MySQL 4.1.9
My user defined tag count_news_comments looks like this:
name: count_news_comments
code:
global $gCms;
$db = &$gCms->db;
// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments
WHERE page_id =".$params['theid']."
AND module_name='News' AND active='1'";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;
DB error: There's something wrong with the used syntax 'AND module_name='News' AND active='1'' on line 3
Fatal error: Call to a member function on a non-object in c:\program files\easyphp1-8\www\blog\lib\content.functions.php(663) : eval()'d code on line 14
I'm running: CMS Made Simple 1.0.2 "Maui", Apache/1.3.33 (Win32) PHP/4.3.10, MySQL 4.1.9
My user defined tag count_news_comments looks like this:
name: count_news_comments
code:
global $gCms;
$db = &$gCms->db;
// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments
WHERE page_id =".$params['theid']."
AND module_name='News' AND active='1'";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;