|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-06 09:27 UTC] aharvey@php.net
-Package: *Database Functions
+Package: MSSQL related
[2016-10-15 23:16 UTC] kalle@php.net
-Status: Open
+Status: Wont fix
[2016-10-15 23:16 UTC] kalle@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
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);