amending server-side script to allow the data source to be an SQL query on a table?

amending server-side script to allow the data source to be an SQL query on a table?

elynchelynch Posts: 3Questions: 1Answers: 0
edited August 2014 in DataTables 1.10

How would I go about amending server-side script (eg http://www.datatables.net/examples/data_sources/server_side.html) to allow the data source to be an SQL query on a table (or table join)?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    The server-side example is already using a SQL query on a table.

    http://datatables.net/examples/data_sources/server_side.html

  • elynchelynch Posts: 3Questions: 1Answers: 0

    If your observation is correct I should be able to replace

    // DB table to use
    $table = 'datatables_demo';

    with

    $sqlstr = "Select ..."; // my query definition (possibly including a join to a linked table)
    $table = $sqlstr;

    Will test this and see how the changes behave.

  • elynchelynch Posts: 3Questions: 1Answers: 0

    Setting $table to an SQL query resulting in the diagnostic -

    1103 Incorrect table name 'SELECT

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Setting $table to an SQL query....

    Why would you do that? The $table variable obviously requires a table name.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Currently no - you cannot use a sub-select in the SSP PHP class. If you want to do that you would need to modify the SSP class.

    Allan

This discussion has been closed.