点燃的数据表调用存储过程 php



我按照教程点燃的数据表 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(); 
    }

当我使用这样的存储过程时,我遇到了麻烦:

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

如何在点燃的数据表中调用存储过程?

如何在库数据表中添加查询函数.php https://github.com/IgnitedDatatables/Ignited-Datatables/blob/master/application/libraries/Datatables.php

你应该试试这种方式

示例代码:

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);
        }

最新更新