Failed to create tables

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
hernan
Posts: 26
Joined: 2020-06-22 18:56

Failed to create tables

Post by hernan » 2022-04-01 10:24

Hi,

I'm having a problem when trying to launch an app.
I recently changed PC and when trying to move my files to the new PC in order to keep working with the app, I can't make it to work.

Using windows 11, with XAMPP.
Appgini version 5.97 (tried with 5.95 with same results)

I just launched the existing code for a working app (working fine in the "old" PC) and I just keep receiving an error:
Fatal error: Uncaught mysqli_sql_exception: Table 'cubicdb_local.projects' doesn't exist in D:\hds\xampp\htdocs\cubicapp-1\db.php:109 Stack trace: #0 D:\hds\xampp\htdocs\cubicapp-1\db.php(109): mysqli_query(Object(mysqli), 'SELECT COUNT(1)...') #1 D:\hds\xampp\htdocs\cubicapp-1\updateDB.php(1183): db_query('SELECT COUNT(1)...') #2 D:\hds\xampp\htdocs\cubicapp-1\updateDB.php(13): setupTable('projects', ' \r\n\t\t\tCREATE TA...', false) #3 D:\hds\xampp\htdocs\cubicapp-1\setup.php(144): include_once('D:\\hds\\xampp\\ht...') #4 {main} thrown in D:\hds\xampp\htdocs\cubicapp-1\db.php on line 109

When trying to open a "fresh" app downloaded from Appgini site (Inventory Manager), I receive the same error (I manually created table transactions that was showing error before) :
Table transactions exists, containing 0 records.Table is up-to-date.

Fatal error: Uncaught mysqli_sql_exception: Table 'invmanager.batches' doesn't exist in D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php:109 Stack trace: #0 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php(109): mysqli_query(Object(mysqli), 'SELECT COUNT(1)...') #1 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\updateDB.php(127): db_query('SELECT COUNT(1)...') #2 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\updateDB.php(29): setupTable('batches', ' \r\n\t\t\tCREATE TA...', false) #3 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\setup.php(144): include_once('D:\\hds\\xampp\\ht...') #4 {main} thrown in D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php on line 109


I'm out of ideas.
I checked and the config for XAMPP is the same in the old and new PC.

Any ideas on where I should look to find the cause of the error?

Thank you!

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Failed to create tables

Post by pbottcher » 2022-04-01 14:21

Hi,

did you check the permission for the user that you are using on the database level?
Can you remove the config.php and setup.md5 file and run the setup again?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

hernan
Posts: 26
Joined: 2020-06-22 18:56

Re: Failed to create tables

Post by hernan » 2022-04-04 07:46

Hi pböttcher ,

Thank you for your reply.
I tried what you suggested, but with same results: error message and tables not created.
The config.php file is not even created due to the error.

Table transactions exists, containing 0 records.Table is up-to-date.

Fatal error: Uncaught mysqli_sql_exception: Table 'invmanager.batches' doesn't exist in D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php:109 Stack trace: #0 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php(109): mysqli_query(Object(mysqli), 'SELECT COUNT(1)...') #1 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\updateDB.php(127): db_query('SELECT COUNT(1)...') #2 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\updateDB.php(29): setupTable('batches', ' \r\n\t\t\tCREATE TA...', false) #3 D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\setup.php(144): include_once('D:\\hds\\xampp\\ht...') #4 {main} thrown in D:\hds\xampp\htdocs\inv-manager-4.6\generated_app\db.php on line 109

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Failed to create tables

Post by pbottcher » 2022-04-04 18:38

Well that sound strange.

Can you just create a plain new app with one table and one field. Then generate that app and run the setup. Does this work?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

hernan
Posts: 26
Joined: 2020-06-22 18:56

Re: Failed to create tables

Post by hernan » 2022-04-04 19:09

I just created a new app with only one table with two fields.
I tried just running the app without the DB created, and I got this error message:


Fatal error: Uncaught mysqli_sql_exception: Unknown database 'newapp' in D:\hds\xampp\htdocs\new_app\db.php:44 Stack trace: #0 D:\hds\xampp\htdocs\new_app\db.php(44): mysqli_select_db(Object(mysqli), 'newapp') #1 D:\hds\xampp\htdocs\new_app\setup.php(107): db_select_db('newapp', Object(mysqli)) #2 {main} thrown in D:\hds\xampp\htdocs\new_app\db.php on line 44

If I manually create the DB, then I have this error:

Fatal error: Uncaught mysqli_sql_exception: Table 'newapp.table1' doesn't exist in D:\hds\xampp\htdocs\new_app\db.php:109 Stack trace: #0 D:\hds\xampp\htdocs\new_app\db.php(109): mysqli_query(Object(mysqli), 'SELECT COUNT(1)...') #1 D:\hds\xampp\htdocs\new_app\updateDB.php(62): db_query('SELECT COUNT(1)...') #2 D:\hds\xampp\htdocs\new_app\updateDB.php(20): setupTable('table1', ' \r\n\t\t\tCREATE TA...', false, Array) #3 D:\hds\xampp\htdocs\new_app\setup.php(144): include_once('D:\\hds\\xampp\\ht...') #4 {main} thrown in D:\hds\xampp\htdocs\new_app\db.php on line 109


And the config.php file is not even created with the setup.

I guess it must have something to do with the XAMPP config somewhere? .. but I don't know where to start looking. :(

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Failed to create tables

Post by pbottcher » 2022-04-04 19:36

ok, so with the new app, you run the setup.php, enter the mysql credentials ghat have full access to your db, correct?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

hernan
Posts: 26
Joined: 2020-06-22 18:56

Re: Failed to create tables

Post by hernan » 2022-04-04 20:15

Thank pböttcher for your help.

Yes I was doing all correctly, apparently it was due to the PHP Version installed in the new PC...

I uninstalled XAMPP (I realised it was the one with PHP 8) and downloaded and installed XAMPP with PHP 7.4.28 / PHP 7.4.28.
And now it's working fine as it should.

Thank you very much!

Post Reply