sqlsrv

Issue executing stored procedure from PHP to a Microsoft SQL SERVER

*爱你&永不变心* 提交于 2019-12-31 02:28:08
问题 I am using the code igniter framework. And I been trying to execute a stored procedure(no params) I wrote on Microsoft SQL Server 2008 from PHP but i get an error . This stored procedure runs good on Microsoft SQL Server with no errors. I am using sqlsrv as the driver and I have a PHP version 5.2 if that helps. This is the error I get Error Number: 01000 [Microsoft][SQL Server Native Client 10.0][SQL Server]Executing SQL directly; no cursor Exec sp_test The following is part of the code I

How to call a stored procedure in CodeIgniter USING SQL SERVER

南笙酒味 提交于 2019-12-25 19:31:30
问题 I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures: $query = $this->db->query( "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); Another way I have tried to create the query with less data is the following , however, it is generating an error: Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server]

How to call a stored procedure in CodeIgniter USING SQL SERVER

醉酒当歌 提交于 2019-12-25 19:31:02
问题 I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures: $query = $this->db->query( "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); Another way I have tried to create the query with less data is the following , however, it is generating an error: Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server]

Laravel sqlsrv works in tinker mode but not in browser

為{幸葍}努か 提交于 2019-12-25 05:58:07
问题 I have a Laravel 5 project (on a CentOS 7 machine) that connects to an external MSSQL database. I followed the setup outlined here using FreeTDS. When I hit the page using a browser I get the error: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9) . But when I use php artisan tinker and do something like App\MyModel::get(); , it returns an Illuminate\Database\Eloquent\Collection instance with the records/models just fine. Anyone knows what's

PHP sqlsrv library handling of varbinary data limits

可紊 提交于 2019-12-24 08:20:47
问题 I have a varbinary(8000) database field in SQL Server that I want to pull out. The sqlsrv limit for varbinary data is 8000. However if I do a select on the data <?php $query = " SELECT myvarbinary FROM table WHERE id = 48033; "; $results = sqlsrv_query($this->conn, $query); return sqlsrv_fetch_array($results, SQLSRV_FETCH_NUMERIC); Then the sqlsrv_fetch_array gives an error: PHP Fatal error: Invalid sql_display_size Truncation solution (works but no use) If I convert the field to varbinary

Stored Procedures work fine in MSQL Studio, but now in PHP

烈酒焚心 提交于 2019-12-23 04:59:09
问题 SQL Stored Procedure returns NULL when I call it from my mobile app or a web browser, but the same procedure returns what it has to when called using SQLPro for MSSQL software if( $conn == FALSE ) { echo "Connection failed."; die( print_r( sqlsrv_errors(), true)); } $query = "EXEC dbo.sp_Pok_Details @oe=17,@code='5907769000409'"; $getProducts = sqlsrv_query($conn, $query); if ($getProducts == FALSE) { die(FormatErrors(sqlsrv_errors())); } while($row = sqlsrv_fetch_array($getProducts, SQLSRV

From PDO to SQLSRV

為{幸葍}努か 提交于 2019-12-23 04:56:28
问题 I used PDO for MYSql before but now i need to use Microsoft SQL Server Driver for PHP. I found the manual. http://php.net/manual/en/book.sqlsrv.php I use Example #2 to connect to the new SQL database: http://www.php.net/manual/en/function.sqlsrv-connect.php How do I 'convert' the following (PDO mysql) to work with sqlsrv: $username = 'test'; try { $conn = new PDO('mysql:host=$host;dbname=$database', $username, password); $stmt = $conn->prepare('SELECT username users WHERE username = :username

From PDO to SQLSRV

强颜欢笑 提交于 2019-12-23 04:56:16
问题 I used PDO for MYSql before but now i need to use Microsoft SQL Server Driver for PHP. I found the manual. http://php.net/manual/en/book.sqlsrv.php I use Example #2 to connect to the new SQL database: http://www.php.net/manual/en/function.sqlsrv-connect.php How do I 'convert' the following (PDO mysql) to work with sqlsrv: $username = 'test'; try { $conn = new PDO('mysql:host=$host;dbname=$database', $username, password); $stmt = $conn->prepare('SELECT username users WHERE username = :username

SQLSRV PDO could not be found

不羁岁月 提交于 2019-12-22 18:49:49
问题 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

Codeigniter MSSQL/SQLSRV Connection

拥有回忆 提交于 2019-12-22 12:35:11
问题 I'm working on a web app that connects to a MSSQL database. I previously managed to connect to the database without any problems, however I made a minor change to the sqlsrv_driver file. I encountered the below error, rolled my changes back to the original file, but there are still issues. I have ensured that I have relevant MS drivers installed, correct port number used, etc however its returning this error: Unable to connect to your database server using the provided settings. Filename: D:.