Error while run a sql with session variable
Error while run a sql with session variable
casilas
Posts: 2Questions: 1Answers: 0
Hi everybody, i got an error while run a sql.
$sql = "SELECT vehicle_request.*, vehicle_request_details.tkh_pergi, vehicle_request_details.masa_pergi, vehicle_request_details.tkh_balik, vehicle_request_details.masa_balik, usr_details.nama, req_direction.nama_perjalanan, req_status.nama_status
FROM vehicle_request
LEFT JOIN vehicle_request_details ON vehicle_request.reff_no = vehicle_request_details.reff_no
LEFT JOIN usr_details ON vehicle_request.usrid = usr_details.id
LEFT JOIN req_direction ON vehicle_request.id_perjalanan = req_direction.id_perjalanan
LEFT JOIN req_status ON vehicle_request.req_status = req_status.kod_status
WHERE vehicle_request.usrid =' " . $_SESSION['usrid'] ." ' ";
<script type="text/javascript" language="javascript" >
$(document).ready(function() {
var dataTable = $('#my-request-list').DataTable( {
responsive: {
details: {
renderer: function ( api, rowIdx ) {
var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
var header = $( api.column( cell.column ).header() );
return '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
} ).toArray().join('');
return data ? $('<table/>').append( data ) : false;
}
}
},
processing: true,
serverSide: true,
ajax: {
url: "my-request-data.php" // json datasource
}
} );
} );
</script>
The error
DataTables warning: table id=my-request-list - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
There a no error if i'm not using SESSION VARIABLE.
i was tried echo $_SESSION['usrid']; and the data was appear, but why it error on datatable sql? Tq
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This discussion has been closed.
Answers
Problem solve.. Sorry for a small mistake..
i'd forgot to put :