Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Joomla CMS [#26863] countMenuChildren has incorrect column reference and generates 1054 error when debug turned on #393

Merged
merged 1 commit into from
Sep 26, 2011

Conversation

katalystsol
Copy link
Contributor

I'm using countMenuChildren in my template (using Joomla 1.7.0). It seems to work fine except when I turned on error reporting / debug. It gave me the following error message:

JDatabaseMySQL::query: 1054 - Unknown column 'parent' in 'where clause' SQL=SELECT COUNT(*) FROM hc5wg_menu WHERE parent = 101 AND published = 1

The page gives a 500 error and has the following backtrace:

Function Location

1 JSite->render() /.../index.php:49
2 JDocumentHTML->parse() /.../includes/application.php:249
3 JDocumentHTML->_fetchTemplate() /.../libraries/joomla/document/html/html.php:378
4 JDocumentHTML->_loadTemplate() /.../libraries/joomla/document/html/html.php:547
5 require() /.../libraries/joomla/document/html/html.php:488
6 JDocumentHTML->countMenuChildren() /.../templates/hp1/index.php:112
7 JDatabase->loadResult() /.../libraries/joomla/document/html/html.php:455
8 JDatabaseMySQLi->query() /.../libraries/joomla/database/database.php:1008
9 JError::raiseError() /.../libraries/joomla/database/database/mysqli.php:535
10 JError::raise() /.../libraries/joomla/error/error.php:215

Line 112 in my template is where I call $this->countMenuChildren()

I looked in the database and there is not a field called 'parent' in the #__menu table. However, there is a field called "parent_id"

The libraries/joomla/document/html/html.php file on line 499 (line 452 in current library used in Joomla 1.7.0) is:

$where[] = 'parent = ' . $active->id;

but I think it should be:

$where[] = 'parent_id = ' . $active->id;

Whenever I make that change, everything seems to work fine.

…ept when I turned on error reporting / debug. It gave me the following error message:


JDatabaseMySQL::query: 1054 - Unknown column 'parent' in 'where clause' SQL=SELECT COUNT(*) FROM hc5wg_menu WHERE parent = 101 AND published = 1

The page gives a 500 error and has the following backtrace:

# 	Function 	Location
1 	JSite->render() 	/.../index.php:49
2 	JDocumentHTML->parse() 	/.../includes/application.php:249
3 	JDocumentHTML->_fetchTemplate() 	/.../libraries/joomla/document/html/html.php:378
4 	JDocumentHTML->_loadTemplate() 	/.../libraries/joomla/document/html/html.php:547
5 	require() 	/.../libraries/joomla/document/html/html.php:488
6 	JDocumentHTML->countMenuChildren() 	/.../templates/hp1/index.php:112
7 	JDatabase->loadResult() 	/.../libraries/joomla/document/html/html.php:455
8 	JDatabaseMySQLi->query() 	/.../libraries/joomla/database/database.php:1008
9 	JError::raiseError() 	/.../libraries/joomla/database/database/mysqli.php:535
10 	JError::raise() 	/.../libraries/joomla/error/error.php:215

Line 112 in my template is where I call $this->countMenuChildren()

I looked in the database and there is not a field called 'parent' in the #__menu table. However, there is a field called "parent_id"

The libraries/joomla/document/html/html.php file on line 499 (line 452 in current library used in Joomla 1.7.0) is:

$where[] = 'parent = ' . $active->id;

but I think it should be:

$where[] = 'parent_id = ' . $active->id;

Whenever I make that change, everything seems to work fine.
chdemko added a commit that referenced this pull request Sep 26, 2011
Joomla CMS [#26863] countMenuChildren has incorrect column reference and generates 1054 error when debug turned on
@chdemko chdemko merged commit 0d53337 into joomla:staging Sep 26, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants