MySQL view instead of tables (not working, causes JSON error)
MySQL view instead of tables (not working, causes JSON error)
Hi,
My DataTables site is now working successfully using a MySQL DB and the PHP server_processing script.
However, when I change the table setting in the PHP file to a MySQL view (instead of an actual table), the page fails to load and a browser error reports:
DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
Am I missing something, or is there some way to easily amend the code somewhere to allow MySQL views to work as well as standard tables?
Sorry if this has been discussed, I did find a few similar issues but not this precise one.
Many thanks.
My DataTables site is now working successfully using a MySQL DB and the PHP server_processing script.
However, when I change the table setting in the PHP file to a MySQL view (instead of an actual table), the page fails to load and a browser error reports:
DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
Am I missing something, or is there some way to easily amend the code somewhere to allow MySQL views to work as well as standard tables?
Sorry if this has been discussed, I did find a few similar issues but not this precise one.
Many thanks.
This discussion has been closed.
Replies
The problem was the "indexed column" which was referring to "id", which wasn't a field that was replicated in my MySQL View.
I've used a random unique field for the "indexed column" instead.
Though I'm not entirely sure of the implications of this, it appears to work fine.