I'm trying to connect to the sql server.I got an error like this:
Fatal error: Uncaught Error: Call to undefined function koolreport\datasources\sqlsrv_connect() in C:\xampp\htdocs\kool\vendor\koolreport\core\src\datasources\SQLSRVDataSource.php:117 Stack trace: #0 C:\xampp\htdocs\kool\vendor\koolreport\core\src\core\DataSource.php(57): koolreport\datasources\SQLSRVDataSource->onInit() #1 C:\xampp\htdocs\kool\vendor\koolreport\core\src\KoolReport.php(264): koolreport\core\DataSource->construct(Array, Object(SaleReport)) #2 C:\xampp\htdocs\kool\salereport\SaleReport.php(22): koolreport\KoolReport->src('sqlserver') #3 C:\xampp\htdocs\kool\vendor\koolreport\core\src\KoolReport.php(100): SaleReport->setup() #4 C:\xampp\htdocs\kool\salereport\index.php(7): koolreport\KoolReport->construct() #5 {main} thrown in C:\xampp\htdocs\kool\vendor\koolreport\core\src\datasources\SQLSRVDataSource.php on line 117
index.php
<?php
require_once "../vendor/autoload.php";
require_once "SaleReport.php";
$report= new SaleReport;
$report->run()->render();
SaleReport.php
<?php
class SaleReport extends \koolreport\Koolreport
{
public function settings()
{
$pathh = '\koolreport\datasources\SQLSRVDataSource';
return array(
"dataSources"=>array(
"sqlserver"=>array(
'host' => '127.0.0.1',
'username' => 'sa',
'password' => '---',
'dbname' => 'NORTHWND',
'class' => $pathh
),
)
);
}
public function setup()
{
$this->src('sqlserver')
->query("
SELECT Products.ProductName, Products.UnitPrice FROM Products WHERE UnitPrice > 100;
")
->pipe($this->dataStore('result'));
}
}
SaleReport.view.php
<html>
<head>
<title>...</title>
</head>
<body>
<?php
\koolreport\widgets\koolphp\Table::create(array(
"dataSource"=>$this->dataStore("result")
));
?>
</body>
</html>