note 105904 modified in function.mssql-execute by danbrown

From: Date: Mon, 26 Sep 2011 14:55:06 +0000
Subject: note 105904 modified in function.mssql-execute by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183446@lists.php.net to get a copy of this message
Output parameters are cryptic to get out. Here's two examples, one if you have no results returned from your stored procedure, one if you do have results returned: <?php /** * using OUTPUT param with no results returned from stored procedure */ $outParamValue = 0; mssql_bind($stmt, '@'.$outParamName, $outParamValue, $outParamType, $is_output = true); mssql_execute($stmt, $skip_results = true); /* N.B. If you don't use $skip_results = true you must use mssql_next_result as below **even if there are no results returned from the stored procedure** */ echo($outParamValue); /** * using OUTPUT param with one result set returned from stored procedure */ $outParamValue = 0; mssql_bind($stmt, '@'.$outParamName, $outParamValue, $outParamType, $is_output = true); $result = mssql_execute($stmt); echo($outParamValue); /* will still be 0 */ mssql_next_result($result); /* N.B. see the Note above about this */ echo($outParamValue); /* correct output */ ?> --was-- Output parameters are cryptic to get out. Here's two examples, one if you have no results returned from your stored procedure, one if you do have results returned: <?php /** * using OUTPUT param with no results returned from stored procedure */ $outParamValue = 0; mssql_bind($stmt, '@'.$outParamName, $outParamValue, $outParamType, $is_output = true); mssql_execute($stmt, $skip_results = true); /* N.B. If you don't use $skip_results = true you must use mssql_next_result as below **even if there are no results returned from the stored procedure** */ echo($outParamValue); /** * using OUTPUT param with one result set returned from stored procedure */ $outParamValue = 0; mssql_bind($stmt, '@'.$outParamName, $outParamValue, $outParamType, $is_output = true); $result = mssql_execute($stmt, $skip_results = true); echo($outParamValue); /* will still be 0 */ mssql_next_result($result); /* N.B. see the Note above about this */ echo($outParamValue); /* correct output */ ?> http://php.net/manual/en/function.mssql-execute.php

« previous php.notes (#183446) next »