I have a problem getting a SQL Server stored procedure to work using PHP. My code is below. The stored procedure is expecting an integer to be passed to it. The message that displays is "Stored procedure error". This shows the connection is working. I'm not sure what's wrong. Can someone help me out? Thanks.
$db_connection = sqlsrv_connect($servername, $connectOpts);
if($db_connection === false) {
echo ("Error connecting to the database.");
exit;
}
$sp_command = "EXEC usp_testsp @valint=?";
$sp_vals = array( array("3", SQLSRV_PARAM_IN));
$sp_execute = sqlsrv_query($db_connection, $sp_command, $sp_vals);
if($sp_execute === false) {echo('Stored procedure error');}
else {echo('Success');}
sqlsrv_close($db_connection);