show depending on a where clause

show depending on a where clause

majkellvzmajkellvz Posts: 8Questions: 3Answers: 0

How can I display data depending on a where clause?

This question has an accepted answers - jump to answer


  • PochoPocho Posts: 3Questions: 1Answers: 1
    Answer ✓

    majkellvz keep in mind I am new with datatables too so this may not be the cleanest way to do it but it worked for me. I used the ssp.class.php helper available here

    with server side processing and using the server side script from this example

    Named it getdata.php and configured the DB information then I changed the last few lines to look like this

    require( 'ssp.class.php' );
    $where = $_GET['where']."'%\\'".$_GET['statement']."\\'%'";
    echo json_encode(
        SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns, $where )

    and then the javascript for the table looks like this

    $('#myTable').DataTable( {                                                                    
        ajax: {                                                      
            "url": "getData.php",
            "data": {
                "where": "dbColumnName = 'something' AND dbColumn2 like",
                "statement": "whereValue",

    This sent the query to the db as

    SELECT * FROM dbColumns WHERE dbColumnName = 'something' AND dbColumn2 like '%\'whereValue\'%'

    Hope it helps

Sign In or Register to comment.