MSSQL / PHP Serverside with Windows Authentication
MSSQL / PHP Serverside with Windows Authentication
Hi,
First off, datatables is awesome, and I'm loving it's simplicity.
Secondly, I'm trying to connect my MSSQL tables to datatables using windows authentication (so passwords don't need to be passed back and forth). I believe I've successfully connected to the database however, I keep getting a JSON formatting error ("JSON data from server cannot be parsed"). Here is my server_processing.php code and html file; any help would be greatly appreciated.
[code]<?php
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "SenderId";
/* DB table to use */
$sTable = "Interchange";
$gaSql['server'] = "LPV-FINCSFS01\EDID";
$gaSql['db'] = "999";
$connectionInfo = array("Database"=>$gaSql['db'],"ReturnDatesAsStrings"=>true);
$gaSql['link'] = sqlsrv_connect( $gaSql['server'], $connectionInfo);
if( $gaSql['link'] === false ){
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
else{
echo "Connected!";
}
$params = array();
/*
* Columns
* If you don't want all of the columns displayed you need to hardcode $aColumns array with your elements.
* If not this will grab all the columns associated with $sTable
*/
$aColumns = array('Filename', 'SenderId', 'ReceiverId', 'ControlNumber');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/* Ordering */
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) ) {
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);
while ( $aRow = sqlsrv_fetch_array( $rResult ) ) {
$row = array();
for ( $i=0 ; $i
[/code]
and here is my .html file
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
999 Reconciliation
@import "/dt/media/css/demo_page.css"; @import "/dt/media/css/header.css";
@import "/dt/media/css/demo_table_jui.css";
@import "/dt/examples/examples_support/themes/ui-lightness/jquery-ui-1.8.4.custom.css";
$(document).ready(function() {
$('#Test').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/dt/examples/server_side/scripts/server_processing.php"
} );
} );
999 Reconciliation
Filename
SenderId
ReceiverId
ControlNumber
Loading data from server
[/code]
First off, datatables is awesome, and I'm loving it's simplicity.
Secondly, I'm trying to connect my MSSQL tables to datatables using windows authentication (so passwords don't need to be passed back and forth). I believe I've successfully connected to the database however, I keep getting a JSON formatting error ("JSON data from server cannot be parsed"). Here is my server_processing.php code and html file; any help would be greatly appreciated.
[code]<?php
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "SenderId";
/* DB table to use */
$sTable = "Interchange";
$gaSql['server'] = "LPV-FINCSFS01\EDID";
$gaSql['db'] = "999";
$connectionInfo = array("Database"=>$gaSql['db'],"ReturnDatesAsStrings"=>true);
$gaSql['link'] = sqlsrv_connect( $gaSql['server'], $connectionInfo);
if( $gaSql['link'] === false ){
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}
else{
echo "Connected!";
}
$params = array();
/*
* Columns
* If you don't want all of the columns displayed you need to hardcode $aColumns array with your elements.
* If not this will grab all the columns associated with $sTable
*/
$aColumns = array('Filename', 'SenderId', 'ReceiverId', 'ControlNumber');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/* Ordering */
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) ) {
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);
while ( $aRow = sqlsrv_fetch_array( $rResult ) ) {
$row = array();
for ( $i=0 ; $i
[/code]
and here is my .html file
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
999 Reconciliation
@import "/dt/media/css/demo_page.css"; @import "/dt/media/css/header.css";
@import "/dt/media/css/demo_table_jui.css";
@import "/dt/examples/examples_support/themes/ui-lightness/jquery-ui-1.8.4.custom.css";
$(document).ready(function() {
$('#Test').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/dt/examples/server_side/scripts/server_processing.php"
} );
} );
999 Reconciliation
Filename
SenderId
ReceiverId
ControlNumber
Loading data from server
[/code]
This discussion has been closed.