Questions tagged [php-mssql]

A PHP extension which allows you to access Microsoft SQL Server databases. It was available until PHP 5.3 (on Windows) and removed in PHP 7.0.0.

54 questions
6
votes
8 answers

SQL Server Stored Procedure Output Params in PHP

I need help running a stored procedure from SQL Server in PHP. PHP is running on a Unix/Linux server. We cannot get OUTPUT variables to return in PHP. The following is the PHP code: $conn = mssql_connect('server', 'user', 'pass'); …
ericwindham
  • 201
  • 2
  • 4
  • 9
5
votes
3 answers

mssql_execute failing with, "stored procedure execution failed"

I am currently connecting sucessfully to an SQL database sat on a Windows 2008 using the following query; $result = mssql_query("EXEC dbo.stored_procedure_name @param_level = 2"); I am basing my queries on existing code written in VB / ADO which…
ismithuk
  • 51
  • 1
  • 3
4
votes
0 answers

mssql_bind in PHP truncates string

I'm using FreeTDS to connect and work with a SQL Server 2008 database from PHP 5.3.15 on Linux. I have a column in this database that has a datatype of VARCHAR(MAX). Unfortunately, I'm having trouble setting the value of the column via mssql_bind()…
tptcat
  • 3,894
  • 2
  • 32
  • 51
3
votes
2 answers

Executing MSSQL stored procedure from php

I am trying to call a MS SQL stored procedure form php. I have tested the stored procedure by itself in management studio with hard coded parameters and was able to get it to execute with the expected results. However when attempt to call it from…
Michael Cole
  • 289
  • 2
  • 7
  • 21
3
votes
1 answer

PHP mssql_bind failure

I've got a stored procedure in MSSQL that takes 2 input parameters. @ID int = 0 and @TYPE varchar(20) = 'Employee' Calling this stored proc from PHP with no input parameters works fine. Calling it with the parameters in Management Studio works…
2
votes
0 answers

PHP 7 migration from mssql to sqlsrv question

The old code looks like $stmt = mssql_init('Deletion_Request_Execute'); mssql_bind($stmt, '@Lead_ID', $lead_id, SQLVARCHAR, false); mssql_execute($stmt,false); mssql_free_statement($stmt); After migration the new code looks like $stmt =…
Joseph
  • 31
  • 2
2
votes
1 answer

PHP 5.4 to 7.4 mssql to sqlsrv sql query not running

A little preface I'm a year one system administrator and I've been migrating servers to get this company up to date. I've run into a server running php 5.4 and I'm trying to move it to php 7.4. Everything was originally written in mssql and I'm…
Jolly9642
  • 33
  • 4
2
votes
0 answers

Converting mssql to sqlsrv in php. Stored procedure no returning correct result when successful

I am upgrading from php 5.5.30 to php 7.2.7. So I have switch code from mssql to sqlsrv. I have php that runs a stored procedure with input parameters that prints the result and then returns a 1 or 0 depending on if it is successful or not, and…
Kmarti33
  • 21
  • 3
2
votes
2 answers

PHP date: non well formed numeric value encountered

I'm trying to store a date from a PHP form into an MS SQL database and am really struggling. The date is in string format, and in 'DD/MM/YYYY' format so I've tried to use strtotime() to convert it, but I just get 1970-01-01 01:00:00 from that. The…
Karen Dixon
  • 43
  • 1
  • 4
1
vote
0 answers

Processmaker SQL Server connection refused

I'm trying to create a connection to a SQL Server database in processmaker. It uses mssql_connect in order to make connection. $link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd ); But the problem is: $link is false…
mhesabi
  • 1,140
  • 3
  • 22
  • 48
1
vote
0 answers

Connect Windows server 2003, php 5.2.6 to Win Server 2019 with SQL Server 2019

I have a production support site that runs on Windows Server 2003, SQL Server 2008 r2, php 5.2.6 and I have to connect it to a new server with windows server 2019 with SQL Server 2019. When I try to connect from the old server to the new one, the…
MarcoAgu
  • 11
  • 3
1
vote
1 answer

Mssql_query can return values after db close, while sqlsrv_query cannot

I am new to backend developer, so this might be dumb if i am wrong in the begining.I found out that sqlsrv and mssql ways of handling db are different. For example, mssql_query can return data after db close, but sqlsrv_query cannot. For example:…
1
vote
1 answer

Change PHP mssql to sqlsrv (mssql_fetch_row)

I have this code: $query="Select SUBJECT,NOTES from CAMPNOTIFICATION where TYPE LIKE 'message_blackboard' AND VALIDAFTER <= GETDATE() AND (VALIDUNTIL >= GETDATE() OR VALIDUNTIL IS NULL)"; $encode = array(); //$query = strtr($query,…
Naschkopf
  • 17
  • 8
1
vote
1 answer

Dynamic mssql_bind invalid type

Attempting to create a function to type less code for mssql_bind I wish to use this 2d array: Array ( [0] => Array ( [0] => SIZECODENO [1] => SQLVARCHAR ) [1] => Array ( [0] =>…
Eugene
  • 17
  • 5
1
vote
2 answers

SQL Server stored procedure error while executing from php

I am trying to execute a stored procedure from php. In the php code iam sending a integer parameter to the stored procedure $orderId =824; $result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, true, false); I getting an error mssql_execute()…
Linto P D
  • 8,839
  • 7
  • 30
  • 39
1
2 3 4