Bug #54435 [Opn->Wfx]: mssql_bind not working in a loop

From: Date: Sat, 15 Oct 2016 23:16:21 +0000
Subject: Bug #54435 [Opn->Wfx]: mssql_bind not working in a loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204809@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54435&edit=1 ID: 54435 Updated by: kalle@php.net Reported by: bruce dot amick at bbvany dot com Summary: mssql_bind not working in a loop -Status: Open +Status: Wont fix Type: Bug Package: MSSQL related Operating System: xp iis PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2011-03-31 19:36:28] bruce dot amick at bbvany dot com Description: ------------ We migrated an application from Apache/mssql to IIS/mssql. All scripts, sprocs, etc stayed the same. Only change was to the database driver. We have a problem in that the mssql_bind now no longer works in the foreach loop. The exact same script does work if we explicitly bind each variable. //this doesn't work: $sp_name = "proc_entity_types"; $paramArray = array(); $paramArray['mode'] = "V"; $paramArray['entity_typeId'] = ""; $paramArray['entity_type'] = ""; $paramArray['retail_type'] = ""; $paramArray['document_mapping_type'] = ""; $procRes = mssql_init($sp_name); foreach($paramArray as $key=>$value) { $value = trim($value); mssql_bind($procRes,"@$key",&$value,SQLVARCHAR); } //this does work(!) $procRes = mssql_init("proc_entity_types"); $mode = "V"; $entity_typeId = ""; $retail_type = ""; $document_mapping_type = ""; mssql_bind($procRes,"@mode",&$mode,SQLVARCHAR); mssql_bind($procRes,"@entity_typeId",&$entity_typeId,SQLVARCHAR); mssql_bind($procRes,"@entity_type",&$entity_type,SQLVARCHAR); mssql_bind($procRes,"@retail_type",&$retail_type,SQLVARCHAR); mssql_bind($procRes,"@document_mapping_type",&$document_mapping_type,SQLVARCHAR); $result = mssql_execute($procRes); //*********/ note: we've tried... 1) mssql_bind($procRes,"@$key",&$value,SQLVARCHAR); 2) mssql_bind($procRes,'@'.$key,&$value,SQLVARCHAR); 3) mssql_bind($procRes,'@'.$key,$value,SQLVARCHAR); We've tried while loops instead of foreach... And again, it all worked fine in apache connecting to the same db. Test script: --------------- //doesn't work: $sp_name = "proc_entity_types"; $paramArray = array(); $paramArray['mode'] = "V"; $paramArray['entity_typeId'] = ""; $paramArray['entity_type'] = ""; $paramArray['retail_type'] = ""; $paramArray['document_mapping_type'] = ""; $procRes = mssql_init($sp_name); foreach($paramArray as $key=>$value) { $value = trim($value); mssql_bind($procRes,"@$key",&$value,SQLVARCHAR); } //this does $procRes = mssql_init("proc_entity_types"); $mode = "V"; $entity_typeId = ""; $retail_type = ""; $document_mapping_type = ""; mssql_bind($procRes,"@mode",&$mode,SQLVARCHAR); mssql_bind($procRes,"@entity_typeId",&$entity_typeId,SQLVARCHAR); mssql_bind($procRes,"@entity_type",&$entity_type,SQLVARCHAR); mssql_bind($procRes,"@retail_type",&$retail_type,SQLVARCHAR); mssql_bind($procRes,"@document_mapping_type",&$document_mapping_type,SQLVARCHAR); $result = mssql_execute($procRes); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54435&edit=1

« previous php.bugs (#204809) next »