Joomla: DB function failed with error number 1054
Posted by admin in joomla, tips
A joomla website was transfered from old server using MySql 4.1.x to new server using MySql 5.
When I tried to edit the website content in joomla administration I got next error:
DB function failed with error number 1054
Unknown column ‘c.access’ in ‘on clause’ SQL=SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author FROM jos_content AS c, jos_categories AS cc, jos_sections AS s LEFT JOIN jos_groups AS g ON g.id = c.access LEFT JOIN jos_users AS u ON u.id = c.checked_out LEFT JOIN jos_users AS v ON v.id = c.created_by LEFT JOIN jos_content_frontpage AS f ON f.content_id = c.id WHERE c.state >= 0 AND c.catid = cc.id AND cc.section = s.id AND s.scope = ‘content’ ORDER BY s.title, c.catid, cc.ordering, cc.title, c.ordering LIMIT 0, 10
The problem can be solved by editing this file: /administrator/components/com_content/admin.content.php
Find:
$query = “SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author”
. “\n FROM #__content AS c, #__categories AS cc, #__sections AS s”
. “\n LEFT JOIN #__groups AS g ON g.id = c.access”
. “\n LEFT JOIN #__users AS u ON u.id = c.checked_out”
. “\n LEFT JOIN #__users AS v ON v.id = c.created_by”
. “\n LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id”
. ( count( $where ) ? “\nWHERE ” . implode( ‘ AND ‘, $where ) : ” )
. $order
. “\n LIMIT $pageNav->limitstart,$pageNav->limit”
;
And replace it with:
$query = “SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author”
. “\n FROM #__content AS c” //, #__categories AS cc, #__sections AS s”
. “\n LEFT JOIN #__groups AS g ON g.id = c.access”
. “\n LEFT JOIN #__users AS u ON u.id = c.checked_out”
. “\n LEFT JOIN #__users AS v ON v.id = c.created_by”
. “\n LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id”
. “\n LEFT OUTER JOIN #__categories AS cc ON c.catid=cc.id”
. “\n LEFT OUTER JOIN #__sections AS s ON cc.section=s.id”
. ( count( $where ) ? “\nWHERE ” . implode( ‘ AND ‘, $where ) : ” )
. $order
. “\n LIMIT $pageNav->limitstart,$pageNav->limit”
;


