#1
I created a test app and set up a Tests module.

I added 3 records under .../tests/manage

Then I added this to the top of the "Tests" Class.



When I refresh the tests/manage page I get this error:

"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order by title' at line 1 in #1 ....../modules/tests/controllers/Tests.php(59): Model->get('title')"

I didn't make any other changes to the default code. Here is line 59:



Any idea why this is happening?

I tested on Xampp 8.2 and Xampp 8.1 and using the latest Trongate v1.0.005 to create the app.
#2
Hi mjim,

This was a weird one to debug but I think I've found the issue.

When you added the constructor to your 'Tests' module and call the '..tests/manage' method Trongate can't find the name of the database table from the URL and creates a malformed SQL - try adding a 'true' to $debug in Model.php.

So the simple workaround is to help Trongate with the database table


I'll have a deeper look into why this happening in Model.php as suspect that in the constructor $current_module is not being defined.

when a call tois made.

Cheers,
Si
#3
Ah yes, forgot about the debug!

Adding the table works for now. :)

It was the only issue holding me back from setting up a multi-tenant app as I need to get the tenant id within the constructor based on the subdomain.

I need to change the $this->model->get() calls anyway since it requires a where clause for the tenant id.

Thank you for looking into this Si!

Jim
#4
Excellent! Thanks Simon and DC!