Handling MySQL errors while querying a DB table through Custom Code

mapme 23 Jul, 2019
We are using a CF4 application to query data dynamically using a Custom Code.
Based on a URL parameter, we know which mySQL table/view to select. It works better than the DB Record Loader because it is unknown which table will be queried in advance. Everything works well, except in some cases the DB table may not exist. This causes an error as follows:
1146
Table 'databasename.#__tbl_1234_5678' doesn't exist
Is there a way to control this MySQL error message if the table doesn't exist? We want the page to keep loading rather than redirect to show this MySQL error.
Thanks.
GreyHead 23 Jul, 2019
Hi Mapme,

I guess that if you are using Custom Code then you can add a line to check that the table exists before you do the main data request.

Bob
This topic is locked and no more replies can be posted.