Invoking a Stored Procedure
suggest changeTo call a stored procedure on the server:
$query = "{call [dbo].[myStoredProcedure](?,?,?)}"; //Parameters '?' includes OUT parameters
$params = array(
array($name, SQLSRV_PARAM_IN),
array($age, SQLSRV_PARAM_IN),
array(&$count, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT) // $count must already be initialized. The leading & lets sqlsrv write the OUT value back.
);
$result = sqlsrv_query($conn, $query, $params);
// $result is false when the call fails. $conn is an open sqlsrv connection.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents