//密码
$password = $_POST["password"];
//用户
$username = $_POST["username"];
$serverName="192.168.1.116";
//使用sql server身份验证,参数使用数组的形式,一次是用户名,密码,数据库名
//如果你使用的是windows身份验证,那么可以去掉用户名和密码
$connectionInfo = array( "UID"=>"sa",
"PWD"=>"sa",
"Database"=>"myData");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql_callSP = "{call SP_RegisterUserName(?,?,?,?,?)}"; //调用存储过程,并填充参数
$strAccounts=$username;
$strPassword=$password;
$wFaceID=1;
$cbGender=1;
$strNiceName=$username;
$params = array( $strAccounts,md5($strPassword),$wFaceID,$cbGender,$strNiceName); //设置参数
$stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
if( $stmt3 === false )
{
echo "Error in executing statement 3.\n";
die( print_r( sqlsrv_errors(), true));
}
参考:
http://bbs.csdn.net/topics/390250006
php5.3执行sql server2005的存储过程,该怎么获取存储过程的查询记录