我正在使用
1- Windows Server 2012 R2
2- SQL Server 2014
3- Codeigniter 3.1
4- PHP 5.6
5- php_sqlsrv_56_ts.dll
我有时会收到此错误:
DOM
答案 0 :(得分:0)
转到application / config / database
https://codeigniter.com/user_guide/database/configuration.html
并设置
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'database_name',
'dbdriver' => 'mysqli',
答案 1 :(得分:-2)
您为SQLSRV驱动程序显示的错误意味着DLL永远不会加载。你的php_info()说了什么?。
此外,您是否安装了SQL Server Native Access Client(SNAC)10? SQLSRV驱动程序需要它。
CodeIgniter的内置ODBC驱动程序,它在表名周围添加了撇号。我快速浏览了odbc_driver.php,改变了引用表的方式并解决了问题
//Database Config file database.php in My case
$db['default']['hostname'] = "Driver={SQLServer};Server=127.0.0.1\YouSqlServerName;Database=DBName;Uid=username;Pwd=password;";
$db['default']['port'] = '1433';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'DBName';
$db['default']['dbdriver'] = 'odbc';