mantisbt-plugins / MantisKanban

23 stars 20 forks source link

Database query error #16

Closed onlyfortheproject closed 1 month ago

onlyfortheproject commented 1 month ago

Hello, :)

We installed the plugin on a fresh Mantis installation, v2.26.2, DB schema v211, PHP 7.2.34, DB driver mysqli, DB version 10.6.18. When trying to use the Kanban button from the Main Menu or when trying to create a Group, we receive the following error:

APPLICATION ERROR #401

Database query failed. Error received from database was #1146: Table 'ws_mant148.db_plugin_MantisKanban_kanbangroups_mantis' doesn't exist for the query: select * from db_plugin_MantisKanban_kanbangroups_mantis order by order_id.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

How could we resolve this issue? Screenshot of the error below.

Kanban Board Error

CasN commented 1 month ago

There seems to be an issue with you table prefix/suffix. In a standard installation the prefix would be 'mantis' and the suffix 'table' so the table would be called 'mantis_plugin_MantisKanban_kanbangroups_table'. Can you check in the DB what the correct plugin is (using phpmyadmin or similar tool)?

onlyfortheproject commented 1 month ago

We installed Mantis with Softaculous.

Table is "mtw7_mantis_MantisKanban_kanbangroups_mantis". DB is example_mant148.

What changes do you suggest to make it work?

CasN commented 1 month ago

Did you check the database if the table is there?

onlyfortheproject commented 1 month ago

The table is there. It's 'mtw7_mantis_MantisKanban_kanbangroups_mantis'.

From config_inc.php we can see:

$g_db_tableprefix ='mtw7'; $g_db_table_plugin_prefix = 'mantis'; $g_db_table_suffix = 'mantis';

The database is 'example_mant148'.

We installed about 10 more plugins and they all work. This one doesn't. 😢

If we properly rename the table, will it work or we should make changes to the code?

CasN commented 1 month ago

You state the database = 'example_mant148' but in the error message I see 'ws_mant148' so it looks theer is something else happening. I do take it that you downloaded from the correct mantis2 branch. mtw7_mantis_MantisKanban_kanbangroups_mantis is not the same as db_plugin_MantisKanban_kanbangroups_mantis And the minimum php level = 7.2.5 so there is a mismatch to start with. The code is ok.

So update php, remove the plugin, download again the plugin from the mantis2 branch (https://github.com/mantisbt-plugins/MantisKanban/tree/MantisBT2.x) and re-install

onlyfortheproject commented 1 month ago

Thank you for your reply. Helped me figure it out.

I had updated the PHP settings before and had set PHP 8.2.

To fix the issue, went to every file of pages/ folder and replaced the original query with the one that uses the hardcoded table name. So, for example in kanban_page.php, instead of

$query = "select * from {plugin_MantisKanban_kanbangroups} order by order_id"; $result = db_query($query);

i wrote

$query = "select * from mtw7_mantis_MantisKanban_kanbangroups_mantis order by order_id"; $result = db_query($query);

and it worked. Thank you :)

CasN commented 1 month ago

Happy you got this to work and clear why it happened. Normally then prefix for the plugin is set to 'plugin' and in principle this is not changed. If you would have changed {plugin_MantisKanban_kanbangroups} to {mantis_MantisKanban_kanbangroups} it would have worked also.