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
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
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.
Labels |
Added:
?
|
||
Build | ⇒ | staging |
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'));