Datatables and serverside processing error

Datatables and serverside processing error

MarloHMarloH Posts: 8Questions: 0Answers: 0
edited February 2012 in DataTables 1.8
I am using the sample code found here (http://datatables.net/release-datatables/examples/server_side/server_side.html), and replaced all of the easy set variables with the needed info for my table and database. However, the table fails to load with a malformed json response, which makes sense, because it sends a query to the processor.php which results in a return of a bunch of php errors, primarily a lot of undefined indexes like sSearch, bSearchable_0 (to 9), sEcho, and others.

The get request also seems malformed as well. It is "http://localhost/dt-server-processing.php?_=1329959353362"

What could be going wrong here?

Replies

  • MarloHMarloH Posts: 8Questions: 0Answers: 0
    I turned off notice reporting and the table worked. However, I hate having to do that, as I build all my code so that my logs are pristine and only contain (mostly) real errors. So advice is still appreciated.
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    What are the notices given? Certainly the script should be made to run cleanly if it doesn't already!

    Allan
  • MarloHMarloH Posts: 8Questions: 0Answers: 0
    I removed paths for security reasons, but the errors are all on the same file (dt-server-processing.php), but different lines.

    ( ! ) Notice: Undefined index: sSearch in dt-server-processing.php on line 87

    ( ! ) Notice: Undefined index: bSearchable_0 in on line 101

    ( ! ) Notice: Undefined index: bSearchable_1 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_2 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_3 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_4 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_5 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_6 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_7 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_8 in on line 101


    ( ! ) Notice: Undefined index: bSearchable_9 in on line 101


    ( ! ) Notice: Undefined variable: sOrder in on line 125


    ( ! ) Notice: Undefined index: sEcho in on line 151

    Just to state again though, the file dt-server-processing.php contains the same php provided at the link above, except I changed the easy set variables as needed.

    Thanks for your help here.
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Thanks for letting me know - the code was slightly out of date from what was actually driving the page (in server_processing.php). The latest version of the code is here: http://datatables.net/development/server-side/php_mysql . I've committed the change for the examples, and they will be updated with the 1.9.1 release (as the examples are tied to the releases).

    Allan
  • MarloHMarloH Posts: 8Questions: 0Answers: 0
    Thanks for taking a look at this.

    Just so I understand your comment, should I wait until the 1.9.1 release to get the updated code, or is the code you linked to fine?

    (I am asking because I am using datatables 1.8 and tried the code you linked to (http://datatables.net/development/server-side/php_mysql) and received the same set of errors.)
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    The PHP code linked to will work just fine with both DataTables 1.8.x and 1.9.x.

    I've just the code from the linked page and it should work no problem - I'm not sure what the problem is there. Could you possible use the DataTables debugger on your table ( http://debug.datatables.net ) so I can see what your configuration is please?

    Thanks,
    Allan
  • agusnur24agusnur24 Posts: 1Questions: 0Answers: 0
    I have the same problem with MarloH, but only sEcho undefined index error that was showed. And I'm using Datatables 1.9.0.

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined index: sEcho

    I'm using Datatables debugger on my table to ( http://debug.datatables.net/etasuw )

    Hope you can check it out?

    Thanks.
This discussion has been closed.