0

I follow tutorial ignited datatables https://github.com/IgnitedDatatables/Ignited-Datatables/wiki/Function-Reference

 function datatables() {
    $this->datatables
            ->select('TerminalID,AtmLocation,MaxNumOfBills1,MaxNumOfBills2')
            ->from('terminalset');
    header('Content-Type: application/json');
    echo $this->datatables->generate(); 
    }

and I have trouble when I use stored procedures like this:

$this->db->query('proc_request "$parameter"');

How to call stored procedure in an ignited datatable?

How do I add a query function in libraries datatables.php? https://github.com/IgnitedDatatables/Ignited-Datatables/blob/master/application/libraries/Datatables.php

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ardy Ant
  • 59
  • 1
  • 10

1 Answers1

0

You should try this way

Sample Code:

function GetLogoById($Id)
        {

            $serverName = "XXXXX";
            $uid = "XXXXXX";
            $pwd = "XXXXXX";

            $connectionInfo = array( "UID"=>$uid,
                    "PWD"=>$pwd,
                    "Database"=>"XXXXXX");
            $conn = sqlsrv_connect( $serverName, $connectionInfo);
            $tsql = "select * from TableName where Id = '$Id'";
            $stmt = sqlsrv_query( $conn, $tsql);
            if( $stmt === false)
            {
                echo "Error in query preparation/execution.\n";
                die( print_r( sqlsrv_errors(), true));
            }
            /* Retrieve each row as an associative array and display the results.*/
            while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
            {
                return $row['ColumnName'];
            }
            /* Free statement and connection resources. */
            sqlsrv_free_stmt( $stmt);
            sqlsrv_close( $conn);

        }
Jignesh.Raj
  • 5,776
  • 4
  • 27
  • 56