I'm sorry for posting this question again, but I searched and read many threads on using fnServerData with no avail. I am trying to only load a list of patients from a specific Dr's ID. The doctor field in the patients DB is populated with the Dr's ID and the session variable that I want to use is $id.
<script type="text/javascript"> $(document).ready(function() { $('#example').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "removedPath" "fnServerData": function ( sSource, aoData, fnCallback ) { aoData.push( { "name" : "doctor", "value" : <?php $id;?> } ); $.getJSON( sSource, aoData, function (json) { fnCallback(json); }); }, } ); } ); </script>
// if id is specified, add it to the WHERE clause if ( isset($_GET['doctor']) && $_GET['doctor'] != "" ) { if ($sWhere) $sWhere .= " AND doctor=".mysql_real_escape_string( $_GET['doctor'] ); else $sWhere = " WHERE doctor=".mysql_real_escape_string( $_GET['doctor'] ); }