Can't read data from MySQL View

Can't read data from MySQL View

ladokjohanladokjohan Posts: 15Questions: 3Answers: 0

Hi,

I am trying to use Server-side Processing based on the example https://datatables.net/examples/server_side/simple.html.

It works fine if I use it on a table in the MySQL database. Output can be seen at gutefar.se/simple.html (and gutefar.se/server_processing.php).

When I try to connect to a MySQL View instead of a MySQL table I run into problem. I get a JSON error when loading gutefar.se/2simple.html. It seems no JSON at all is loaded. Data should be printed at gutefar.se/2server_processing.php but it is empty. I have tried several ways to solve it, but can't figure out why it don't work.

To see if there is any problem with the sql to the view I made exactly the same query by php from a separate file which gives expected result: gutefar.se/2test.php. So db seems to work fine.

Debug: https://debug.datatables.net/anovop

I'm looking forward to read your suggestions.

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    I'd suggest having a look at the server's error log to see if there is anything reported there.

    Allan

  • ladokjohanladokjohan Posts: 15Questions: 3Answers: 0

    Thanks for your suggestion. Unfortunately, nothing is written in the log file on my hosting.

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    Could you add these two lines at the top of your PHP server-side processing file please (inside the <?php tag):

    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    

    Allan

This discussion has been closed.