?
avatar csbalazs
csbalazs
19 Apr 2012

One of my own component (business directory) ran perfectly on 1.7 and
after updating to 2.5 it throws the following error referring to an SQL
query:

JDatabaseMySQLi::query: 1064 - You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near '' at line 1 SQL=SELECT jos_bd_packages.picture_num
FROM jos_bd_businesses LEFT JOIN jos_bd_packages ON
jos_bd_packages.id=jos_bd_businesses.package_id WHERE jos_bd_businesses.id=

Call stack

Function Location

1 JAdministrator->dispatch() /var/www/virtual/domain.com/htdocs/administrator/index.php:46
2 JComponentHelper::renderComponent() /var/www/virtual/domain.com/htdocs/administrator/includes/application.php:152
3 JComponentHelper::executeComponent() /var/www/virtual/domain.com/htdocs/libraries/joomla/application/component/helper.php:357
4 require_once() /var/www/virtual/domain.com/htdocs/libraries/joomla/application/component/helper.php:388
5 JController->execute() /var/www/virtual/domain.com/htdocs/administrator/components/com_businessdirectory/businessdirectory.php:12
6 BusinessDirectoryController->display() /var/www/virtual/domain.com/htdocs/libraries/joomla/application/component/controller.php:754
7 JController->display() /var/www/virtual/domain.com/htdocs/administrator/components/com_businessdirectory/controller.php:11
8 BusinessDirectoryViewBusiness->display() /var/www/virtual/domain.com/htdocs/libraries/joomla/application/component/controller.php:715
9 JView->get() /var/www/virtual/domain.com/htdocs/administrator/components/com_businessdirectory/views/business/view.html.php:10
10 BusinessDirectoryModelBusiness->getForm() /var/www/virtual/domain.com/htdocs/libraries/joomla/application/component/view.php:482
11 JDatabase->loadResult() /var/www/virtual/domain.com/htdocs/administrator/components/com_businessdirectory/models/business.php:37
12 JDatabaseMySQLi->query() /var/www/virtual/domain.com/htdocs/libraries/joomla/database/database.php:1109
13 JError::raiseError() /var/www/virtual/domain.com/htdocs/libraries/joomla/database/database/mysqli.php:396
14 JError::raise() /var/www/virtual/domain.com/htdocs/libraries/joomla/error/error.php:251

The interesting thing is, that every other query works fine under Joomla
2.5.

Is there some kind of change in query syntax between 1.7 and 2.5?
I'm looking for a solution for the problem.

Joomlacode:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28435

avatar csbalazs csbalazs - open - 19 Apr 2012
avatar csbalazs
csbalazs - comment - 20 Apr 2012

query in business.php:

$db->setQuery("SELECT #bd_packages.picture_num FROM #bd_businesses
LEFT JOIN #bd_packages ON #bd_packages.id=#bd_businesses.package_id WHERE
#
bd_businesses.id=".JRequest::getVar('id'));

avatar csbalazs
csbalazs - comment - 29 May 2012

I have found the source of the problem.
It was in a custom list field with the following line:
$query = new JDatabaseQuery;
The "new JDatabaseQuery" is probably not supported any more in 2.5,
so it only works with the following:
$query = $db->getQuery(true); - where $db id the database object.

avatar zero-24 zero-24 - close - 29 May 2012
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
Build staging

Add a Comment

Login with GitHub to post a comment