PHP Sql Server Output Parameter

后端 未结 1 1915
囚心锁ツ
囚心锁ツ 2021-01-15 15:56

I\'m struggling with an output parameter in PHP and SQL Server 2008. I keep getting the error:

Notice: Undefined variable: UserID in C:\\inetpub\\www

相关标签:
1条回答
  • 2021-01-15 16:26

    I am not 100% sure, but I believe this is asking you to assign a type to the output.
    Try changing this:

    $params = array(
                    array($_POST["FirstName"], SQLSRV_PARAM_IN),
                    array($_POST["LastName"], SQLSRV_PARAM_IN),
                    array($_POST["Email"], SQLSRV_PARAM_IN),
                    array($_POST["Username"], SQLSRV_PARAM_IN),
                    array(md5($_POST["Password"]), SQLSRV_PARAM_IN),
                    array(date("Y-m-d H:i:s"), SQLSRV_PARAM_IN),
                    array($_SERVER["REMOTE_ADDR"], SQLSRV_PARAM_IN),
                    array("Member", SQLSRV_PARAM_IN),
                    array("No", SQLSRV_PARAM_IN),
                    array($UserID, SQLSRV_PARAM_OUT)
                   );
    

    to

    $params = array(
                    array($_POST["FirstName"], SQLSRV_PARAM_IN),
                    array($_POST["LastName"], SQLSRV_PARAM_IN),
                    array($_POST["Email"], SQLSRV_PARAM_IN),
                    array($_POST["Username"], SQLSRV_PARAM_IN),
                    array(md5($_POST["Password"]), SQLSRV_PARAM_IN),
                    array(date("Y-m-d H:i:s"), SQLSRV_PARAM_IN),
                    array($_SERVER["REMOTE_ADDR"], SQLSRV_PARAM_IN),
                    array("Member", SQLSRV_PARAM_IN),
                    array("No", SQLSRV_PARAM_IN),
                    array($UserID, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT)
                   );
    

    ref from: here

    0 讨论(0)
提交回复
热议问题