/* 存储过程测试 */
//error_reporting(0);
/* 存储过程: 数据库连接
------------------------------------------------------*/
define('MSDB_HOST', '1.2.3.4');
define('MSDB_PORT', 1433);
define('MSDB_USER', 'yang');
define('MSDB_PASS', 'yangjunwei');
define('MSDB_NAME', 'GameUserDB');
$conn = mssql_connect(MSDB_HOST,MSDB_USER,MSDB_PASS) or die("SQL SERVER 数据库连接失败!");
mssql_select_db(MSDB_NAME);
/* 存储过程: 修改指定用户密码
------------------------------------------------------*/
$action_type = 'LostPass'; // 操作类型
$User_ID = 1; //用户ID
$User_name = 'yang'; //用户名
$User_pass = md5("123456"); //原用户密码
$User_pass2 = md5("654321"); //新用户密码
$User_null = NULL;
$stmt = mssql_init("UpdateUserInfo", $conn) or die("initialize stored procedure failure");//初始化一个存储过程
mssql_bind($stmt, "@Typ", $action_type, SQLVARCHAR);
mssql_bind($stmt, "@UserID", $User_ID, SQLINT4);
mssql_bind($stmt, "@LogonPass", $User_pass, SQLCHAR);
mssql_bind($stmt, "@LogonPass2", $User_pass2, SQLCHAR);
mssql_bind($stmt, "@dwUserID", $User_null, SQLINT4, false, false);
mssql_bind($stmt, "@strCompellation", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strQQ", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strEmail", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strSeatPhone", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strMobilePhone", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strDwellingPlace", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strPostalCode", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@strUserNote", $User_null, SQLVARCHAR);
mssql_bind($stmt, "@FaceID", $User_null, SQLINT4);
/*
mssql_bind($stmt,"RETVAL",$val,SQLVARCHAR); //用于直接返回return -103此类的值。
$result = mssql_execute($stmt, true); //不能返回结果集,只能得到输出参数
echo $val.' ';
echo "This user id is: ".$UserID.' ';
echo "This user name is: ".$Accounts.' ';
*/
$result = mssql_execute($stmt,false); //返回结果集
$records=mssql_fetch_array($result);
print_r($records);
mssql_next_result($result); //下一个结果集,当等于FALSE的时候下一个就是输出参数
// MSSQL 调试
//die('MSSQL error: ' . mssql_get_last_message());
//exit;
?>
|