Quote Originally Posted by strelitzia View Post
Zen Cart 1.5.7c
PHP Version 7.4.16
MySQL 5.7.32

I'm getting a MySQL error with exports for Manufacturers, ProuctsAttribsbasic, and Products.
For a manufacturers export the log is as follows:
Code:
[06-Aug-2021 20:33:34 Europe/Paris] Request URI: /testadmin/index.php?cmd=dbio_manager&action=export, IP address: ::1
#1  trigger_error() called at [/Users/steph/Sites/localhost/homebrew/includes/classes/db/mysql/query_factory.php:170]
#2  queryFactory->show_error() called at [/Users/steph/Sites/localhost/homebrew/includes/classes/db/mysql/query_factory.php:142]
#3  queryFactory->set_error() called at [/Users/steph/Sites/localhost/homebrew/includes/classes/db/mysql/query_factory.php:269]
#4  queryFactory->Execute() called at [/Users/steph/Sites/localhost/homebrew/testadmin/includes/classes/dbio/DbIo.php:167]
#5  DbIo->dbioExport() called at [/Users/steph/Sites/localhost/homebrew/testadmin/dbio_manager.php:156]
#6  require(/Users/steph/Sites/localhost/homebrew/testadmin/dbio_manager.php) called at [/Users/steph/Sites/localhost/homebrew/testadmin/index.php:11]
--> PHP Fatal error: 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 'ORDER BY m.manufacturers_id ASC' at line 1 :: SELECT m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, m.date_added, m.last_modified FROM zen_manufacturers AS m, zen_manufacturers_info AS mi WHERE m.manufacturers_id = mi.manufacturers_id AND mi.languages_id =  ORDER BY m.manufacturers_id ASC  ==> (as called by) /Users/steph/Sites/localhost/homebrew/testadmin/includes/classes/dbio/DbIo.php on line 167 <== in /Users/steph/Sites/localhost/homebrew/includes/classes/db/mysql/query_factory.php on line 170.
Note the lack of a languages_id just before the ORDER BY.

I went to DbioManufacturersHandler.php and set some error_log outputs after
Code:
$export_language = ($this->export_language == 'all') ? $this->languages[$this->first_language_code] : $this->languages[$this->export_language];

error_log("export language: ".$this->export_language);
error_log("first_language_code: ".$this->languages[$this->first_language_code]);
error_log("this export langueage: ".$this->languages[$this->export_language]);
error_log("export language var: ".$export_language);
the results of which are
Code:
[06-Aug-2021 20:33:34 Europe/Paris] export language: all
[06-Aug-2021 20:33:34 Europe/Paris] first_language_code: 
[06-Aug-2021 20:33:34 Europe/Paris] this export langueage: 
[06-Aug-2021 20:33:34 Europe/Paris] export language var:
The error logs for ProuctsAttribsbasic and Products also show a missing language_id in the query.

Any suggestions on the cause, and a solution to this issue?
Obviously a multiple-language failure is the cause; the solution will be an update to those handlers. See (https://github.com/lat9/dbio/issues/193) for the tracking of these changes.