How to get a php session variable and use it in the where clause at ssp to get a single ligne record

How to get a php session variable and use it in the where clause at ssp to get a single ligne record

ox-box-b Posts: 2Questions: 2Answers: 0

i spend hours on searching for a solution to filter table and show only the ligne recordes where column equal the value of session variable for that i try this:

i called only one variable session into the server-response.php on head of file : require_once("./_inc/config.php") and i have stocked this session variable to a second variablea as next: $CodeApogee = $_SESSION["code_apogee"];
and this variable i used it as condition in the $sWhere clause as next :

/*
Script: DataTables server-side script for PHP and MySQL
* Copyright: 2012 - John Becker, Beckersoft, Inc.
* Filtering
* NOTE this does not match the built-in DataTables filtering which does it
* word by word on any field. It's possible to do here, but concerned about efficiency
* on very large tables, and MySQL's regex functionality is very limited
*/
$CodeApogee = $_SESSION['code_apogee']; //changes

    $sWhere = "notes.code_apogee=".$CodeApogee." ";
    if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" ) {
        $sWhere = "WHERE (notes.code_apogee=".$CodeApogee.")"; //changes
        for ( $i=0 ; $i<count($columns) ; $i++ ) {
            if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" ) {
                $sWhere .= "`".$columns[$i]."` LIKE :search OR ";
            }
        }
        $sWhere = substr_replace( $sWhere, "", -3 );
        $sWhere .= ')';
    }

_
and my data.php file look like:_

$(document).ready(function() {
$('#note').dataTable( {
"aProcessing": true,
"aServerSide": true,
"ordering": false,
"searching": true,
"paging": true,

responsive: true,
"ajax": { url: "server-response.php",
type: 'POST'

    }

} );
} );

</script>
</head>

<body class="note">

<

table id="note" class="display responsive table table-striped table-hover dt-responsive" cellspacing="0" width="100%">
<thead>
<tr>
<th class="all" >Code Apogee</th>
<th class="min-phone-l" >Nom</th>
<th class="min-phone-l">Prenom</th>

also the datatable style wont run like i configure it.

please help me i hav read this post and i cant figure out how to do the same,
https://datatables.net/forums/discussion/20895/retrieve-session-from-php-and-use-in-datatable-as-query-variable
here's the firebug screenshot one record has been filtred out but no data comes with from the table.

yoy.PNG 33.4K
This discussion has been closed.