sqlsrv

PHP sqlsrv: passing a resource from a function

僤鯓⒐⒋嵵緔 提交于 2019-12-10 23:16:42
问题 PHP 5.4.14 SQL Server 2012/SQL Client 2012 Windows 2008 R2 I have a function (simplified version follows) that I call to run a SQL query. It works correctly: connects to DB; runs query and obtains a valid resource. The problem is that the resource that gets returned is null... function squeal($query) { $serverName = "XXXXXXXX\SQLEXPRESS"; $uid = "private"; $pwd = "private"; $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>"DBname"); /* Connect using SQL Server Authentication. */

PDOException: SQLSTATE 01002 Adaptive Server connection failed (severity 9)

大城市里の小女人 提交于 2019-12-10 20:49:59
问题 I have been following some answers over stackoverflow. My odbc. ini (located in /etc/odbc.ini) [MSSQL] Description = MS SQL Server Driver = /usr/local/lib/libtdsodbc.so Server = host.of.the.server UID = myusername PWD = mypassword ReadOnly = No Port = 1433 tds version = 8.0 My odbcinst.ini [FreeTDS] Description = FreeTDS driver Driver = /usr/local/lib/libtdsodbc.so Setup=/usr/lib/odbc/libtdsS.so FileUsage = 1 UsageCount = 1 Both of these files are empty at first. I just copied answer from the

Calling a stored procedure with SQLSRV [duplicate]

天大地大妈咪最大 提交于 2019-12-10 14:28:50
问题 This question already has answers here : Getting output of MS stored proc on php call (sqlsrv) (2 answers) Closed 12 days ago . So I have a stored procedure I'd like to call, it takes one argument as an integer and returns 10 companies. Here's the SP inside MSSQL http://pastebin.com/shhakP81 here's my sql statement $companiesSQL = "{call WEBgetCompanylistByIndIDTen( ? )}"; the parameter $params = array(array($industryID, SQLSRV_PARAM_IN)); the query $companiesStmt = sqlsrv_query(

PHP SQL Server Couldn't connect

倖福魔咒の 提交于 2019-12-07 20:59:01
问题 I want to ask you about how to connect to MSSQL Server 2005 using PHP? I got error like this : Connection could not be established. Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL

php 7 unable to initialize sqlsrv

一个人想着一个人 提交于 2019-12-06 21:31:55
问题 I searched all day to find out a solution for sqlsrv dll on php 7 VC14 x64 Thread Safe and i did not found a solution. Does anyone solved this issue : [04-Oct-2015 19:48:05 UTC] PHP Warning: PHP Startup: pdo_sqlsrv: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20141001 These options need to match in Unknown on line 0 Here is my php7 RC4 informations : System Windows NT 6.0 build 6002 (Windows Server 2008 Standard Edition Service Pack 2)

PDO::rowCount() returning -1

老子叫甜甜 提交于 2019-12-06 14:29:27
i have this function below. that i used to run on a MySQL DB. I had to move to a SQL Server 2008 , easy thing. But, after that, the rowCount() keeps returning -1 , I've never had this happen before. I'm sure that my SQL query is returning the results, because if I do a print_r() on my return (the $rows var), everything gets printed. So, if anyone had this issue, please help me to figure this out. Sorry for any grammatical mistake. public function listar(){ $retorno = array(); $sql = "SELECT m.id, m.descricao, m.link, m.categoria, m.icone FROM menus AS m, grupos AS g, permissoes AS p WHERE (g

SQLSRV PDO could not be found

时光毁灭记忆、已成空白 提交于 2019-12-06 12:59:29
I'm trying to configure php_pdo_sqlsrv_55_ts.dll on Windows 7 x64, with on board XAMPP x86. I've correctly installed the SQL Native Client 2012 and the Microsoft Visual C++ Redistributable (x64) package (I don't know if the last one is needed or not). I've copied to C:\xampp\php\ext\ both the php_pdo_sqlsrv_55_ts.dll and the php_sqlsrv_55_ts.dll libraries downloaded from the unofficial release found here . Then I've edited the php.ini adding the two libraries and restarted the Apache web server but in the phpinfo() page there are not traces of the sqlsrv driver. The Apache error log says: [21

php 7 unable to initialize sqlsrv

孤街浪徒 提交于 2019-12-05 03:57:00
I searched all day to find out a solution for sqlsrv dll on php 7 VC14 x64 Thread Safe and i did not found a solution. Does anyone solved this issue : [04-Oct-2015 19:48:05 UTC] PHP Warning: PHP Startup: pdo_sqlsrv: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20141001 These options need to match in Unknown on line 0 Here is my php7 RC4 informations : System Windows NT 6.0 build 6002 (Windows Server 2008 Standard Edition Service Pack 2) AMD64 Build Date Sep 29 2015 17:15:28 Compiler MSVC14 (Visual C++ 2015) Architecture x64 sqlsrv isn't

Connecting to SQL Server via CodeIgniter

时光毁灭记忆、已成空白 提交于 2019-12-05 01:57:51
问题 I'm trying to setup a Windows dev environment: Windows 8.1 with IIS 8.5 running SQL Server 2008RC2 and PHP 5.3.24 CodeIgniter 2.1.4 I can connect to the database just fine via PDO in a normal PHP script. But when I try to connect via CodeIgniter I get this error: "Unable to connect to your database server using the provided settings. Filename: C\inetpub\wwwroot\ci\system\database\DB_Driver.php Line number 124" If I open PHP Manager in the IIS interface I can see that the two required drivers

PHP sqlsrv query to database

谁都会走 提交于 2019-12-04 17:47:15
问题 I am migrated from MySQL to MS SQL Server, and trying to fetch all data from the routines table. I am connected but unsure how to fetch data with sqlsrv. This is how far I have came: $conn_array = array ( "UID" => "sa", "PWD" => "root", "Database" => "nih_bw", ); $conn = sqlsrv_connect('BILAL', $conn_array); if ($conn){ echo "connected"; $result = sqlsrv_query($db->db_conn,"SELECT * FROM routines"); }else{ die(print_r(sqlsrv_errors(), true)); } sqlsrv_close($conn); ?> 回答1: First if I'm not