I had the same problem (maybe you notice that it happens only with JSON data)
Here's what I've done:
- Opening directly in the browser the “example.php” page gave me the same error with a couple of warning about “undefined index”: something like:
Notice: Undefined index: sord in D:\Web\php\demo\example.php on line 27
Warning: Division by zero in D:\Web\php\demo\example.php on line 45
Couldn t execute query.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
- I added a querystring to see if the file was working (the page needs some input data to initialize it):
http://path_to_file/example.php?page=1&rows=10
well, the JSON data was there, at the bottom of the page, but still had the “undefined index” notifications: then I started thinking that these notifications could be bad for the “example.html” page to read JSON data…
- I suppressed all the warning and notifications adding the line:
ini_set('display_errors', 0);
at the top of the example.php page: it works!!!
So, for me the key was to use the script as in a production environment, without warning and displaying errors: hope it can help!