Cannot get server side processing to work with MS SQL

Cannot get server side processing to work with MS SQL

icelander13icelander13 Posts: 3Questions: 0Answers: 0
edited March 2013 in General
I am SQL savvy, but am a relative newbie to DataTables, PHP, JavaScript, etc..

I need to figure out how to use DataTables to select multiple rows of data, then pass the cell results of a single column to another php based web page to generate some charts.

I've been able to use the basic data tables with an href to chart a single row, but I cannot figure out how to use any of the "select rows" examples, particularly the ones that involve Ajax/JSON.

Currently, I am trying to follow the example in "Server Side PRocessing" called "User selectable rows". Because I have an MS-SQL DB, I tried using the server side script called "PHP with MSSQL ODBC" under the development tab, filled in our parameters, but all I get when I run it is the "Processing" box in the live example. My guess is that I am not making a successful connection to the DB.

If anyone has a working example with MS SQL, I would be very grateful!

Replies

  • pmirandapmiranda Posts: 10Questions: 0Answers: 0
    btw, it's important to mention that the php script, which is below, works fine:

    <?php
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    * Setar variaveis
    */

    // colunas do banco de dados
    $aColumns = array( 'column1', 'column2', 'column3', 'column4', 'column5' );

    /* Informacoes sobre o MSSQL Database */
    $host = 'meu_host';
    $user = "meu_usuario";
    $pass = "minha_senha";
    $db = "meu_banco";

    /* Conexao ao MSSQL */
    $conn = sqlsrv_connect($host, array('UID'=>$user, 'PWD'=>$pass, 'Database'=>$db));

    /* coluna Indexada */
    $sIndexColumn = "id_cadastro";

    /* Tabela do Banco */
    $sTable = "Cadastro_Geral";

    /*
    * Funcoes locais
    */
    function fatal_error ( $sErrorMessage = '' )
    {
    header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
    die( $sErrorMessage );
    }


    /* Ordenamento */
    $sOrder = "";
    if ( isset( $_GET['iSortCol_0'] ) )
    {
    $sOrder = "ORDER BY ";
    for ( $i=0 ; $i $iTotal,
    "iTotalDisplayRecords" => $iFilteredTotal,
    "aaData" => array()
    );

    do {
    while ( $aRow = sqlsrv_fetch_array( $rResult, SQLSRV_FETCH_ASSOC ) ) {
    $row = array();
    for ( $i=0 ; $i
  • pmirandapmiranda Posts: 10Questions: 0Answers: 0
    please. I'm sorry. I've posted in the wrong discussion
This discussion has been closed.