giandonatoinverso / PHP-Dynamic-Qr-code

PHP Dynamic Qr code is a script that allows the generation and saving of dynamic and static QR codes
MIT License
268 stars 76 forks source link

Update from version 1.0 to 2.0 gives error related to table name. #75

Closed hkdemiralp closed 7 months ago

hkdemiralp commented 9 months ago

Hi. I tried to update from version 1.0 to 2.0 but now it doesn't work. I upgraded with these method: 1- First git clone the repo, 2- Edit the config/environment.php, 3- Copy old saved_qrcode directory to new place. 4- Adjusted apache vhost file, (document root changed from qrcode to src) 5- Run upgrade/upgrade.php. It gave the following output.

Upgrading from version 1.0 to a version >= 2.0.
The admin_accounts table has been renamed to users successfully.
The user_name column has been renamed to username successfully.
The admin_type column was renamed to type successfully.
The id_owner column has been added to dynamic_qrcodes successfully.
The id_owner column has been added to static_qrcodes successfully.

I get login screen. But after I login I get this error:

Fatal error: Uncaught mysqli_sql_exception: Table 'qrtest.qr_qr_dynamic_qrcodes' doesn't exist in /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php:1988 Stack trace: #0 /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php(1988): mysqli->prepare() #1 /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php(1594): MysqliDb->_prepareQuery() #2 /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php(738): MysqliDb->_buildQuery() #3 /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php(764): MysqliDb->get() #4 /var/www/html/qrcode/src/index.php(29): MysqliDb->getOne() #5 {main} thrown in /var/www/html/qrcode/src/lib/MysqliDb/MysqliDb.php on line 1988

NOTE 1: Now table name is "qr_dynamic_qrcodes" in database. But the error message looks for "qr_qr_dynamic_qrcodes". In config/environment.php file it is like this: define('DATABASE_PREFIX', "qr_"); NOTE 2: If I delete the tables and run install/setup.php, it gives the same error. NOTE 3: If I create "qr_qr_dynamic_qrcodes" table and then copy everything into it from the table "qr_dynamic_qrcodes", Everything starts to work. But if I delete any of the table, it gave the same error. What should I do?

giandonatoinverso commented 9 months ago

Hi this error is very strange because in the upgrade.php file all tables are renamed with prefix + table name. Then in the file environment.php file you have the same prefix so I can’t explain myself this. Now I tag this issue with bug label, thanks for report me.

lukolb commented 9 months ago

I'm having the exact same issue. And since there are now two different tables in use, there are quite a few bugs. Couldn't locate the problem yet.

simenah commented 7 months ago

Any updates on this? Same issue here. Been looking through the code, and I'm having a hard time locating the reason for the bug.

giandonatoinverso commented 7 months ago

No sorry. Currently I haven’t time for working on this project

simenah commented 7 months ago

No sorry. Currently I haven’t time for working on this project

Understood. Thanks for letting me know!

giandonatoinverso commented 7 months ago

Solved in the new release. Download the new code or use the latest docker image