|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36961 mssql_bind will not bind an image field
Submitted: 2006-04-03 22:23 UTC Modified: 2016-10-15 23:07 UTC
Avg. Score:4.8 ± 0.6
Reproduced:9 of 9 (100.0%)
Same Version:5 (55.6%)
Same OS:3 (33.3%)
From: rnerovich at gmail dot com Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2CVS-2007-07-11 OS: Win2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rnerovich at gmail dot com
New email:
PHP Version: OS:


 [2006-04-03 22:23 UTC] rnerovich at gmail dot com
When inserting an image into MSSQL using SQLVARCHAR, this error is thrown with mssql_bind()...
Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter (not expected)

If SQLTEXT is used the bind succeeds, but the execute fails with...
Operand type clash: text is incompatible with image (expected)

Reproduce code:
// $filedata read in from drive, $filelen = lenth of data
$sp = mssql_init('MSG_PROC_TEST',$dblink->dbresource);
$mrecnum = '{1C296DF1-EE73-436E-BC55-09C58F53C132}';
$mfilename = '1075318802KUZMA.WAV';
mssql_bind($sp,"@MRECNUM", $mrecnum,SQLVARCHAR,FALSE,FALSE,38);
mssql_bind($sp,"@MFILENAME",$mfilename, SQLVARCHAR,FALSE,FALSE,strlen($mfilename));
mssql_bind($sp,"@MWAVS",$filedata, SQLVARCHAR,false,false,$filelen);

sp example

Expected result:
Insert file into image field in MSSQL successfully.

Actual result:
mssql_bind() or mssql_execute() fails because the data conversion to an image type doesn't work correctly.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-11 17:59 UTC] rnerovich at gmail dot com
Tried the release at and got the following calling mssql_bind($sp,"@WAVEIMAGE",$waveinfo,SQLVARCHAR,FALSE,FALSE,$length);
Error:E_WARNING mssql_bind()['a href='function.mssql-bind'>function.mssql-bind</a>]: Unable to set parameter at <xx.php> line xx
 [2007-08-17 10:56 UTC]
Assigned to the maintainer.
 [2008-05-28 16:10 UTC] dmeglio at rightreasontech dot com
Does this issue still exist? I'm still having this issue 2 years after it was reported. 

Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in ... on line 135
 [2008-05-28 16:21 UTC] rnerovich at gmail dot com
I've not gotten any updates in almost a year on the issue.  It's one of the reasons we've had to abandon PHP in our next generation of our products.
 [2008-12-15 22:30 UTC] timbob1000 at gmail dot com
Is anybody working on this?
 [2014-12-29 01:05 UTC]
-Status: Assigned +Status: Open -Assigned To: fmk +Assigned To:
 [2016-10-15 23:07 UTC]
-Status: Open +Status: Wont fix
 [2016-10-15 23:07 UTC]
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 02:01:23 2020 UTC