Strange values returned from Stored Procedure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gazchurchend

    #1

    Strange values returned from Stored Procedure

    Hi
    I have been trying to use stored procedures in PHP as shown in the
    example below. But all the ones I have tried return strange values.
    This simple function simply returns a user id given their logon
    details. It should return 89 but returns 24772797. I have tried
    different SQL type references shown i.e. SQLINT1 etc. but all do the
    same....

    I am stuck, HELP PLEASE.... Are there other ways I should be trying. I
    am using PHP 5 on IIS6 with SQL SERVER 2000.

    -------------------------------------------------------------------------------------------------------------
    $link_id = mssql_connect(" any","sa","some thing");
    mssql_select_db ("dev", $link_id);

    $proc = mssql_init("spG etWhoAmILoggedI nAs", $link_id);

    $login = "LGROUP\J_BLOGG S";

    mssql_bind($pro c, "@NTAccountLogi n", $login, SQLCHAR);
    mssql_bind($pro c, "@StaffID", &$staffid, SQLINT2, TRUE);

    $result = mssql_execute ($proc);

    echo "STAFFID - ".$staffid."<br >";
    --------------------------------------------------------------------------------------------------------------

    Thank you in advance.....

  • Gazchurchend

    #2
    Re: Strange values returned from Stored Procedure

    Please ignore....... I went through all the SQL types and found my
    output value should have been SQLINT4!!!

    Sure i'de tried it before..... sorry

    Gazchurchend wrote:[color=blue]
    > Hi
    > I have been trying to use stored procedures in PHP as shown in the
    > example below. But all the ones I have tried return strange values.
    > This simple function simply returns a user id given their logon
    > details. It should return 89 but returns 24772797. I have tried
    > different SQL type references shown i.e. SQLINT1 etc. but all do the
    > same....
    >
    > I am stuck, HELP PLEASE.... Are there other ways I should be trying. I
    > am using PHP 5 on IIS6 with SQL SERVER 2000.
    >
    > -------------------------------------------------------------------------------------------------------------
    > $link_id = mssql_connect(" any","sa","some thing");
    > mssql_select_db ("dev", $link_id);
    >
    > $proc = mssql_init("spG etWhoAmILoggedI nAs", $link_id);
    >
    > $login = "LGROUP\J_BLOGG S";
    >
    > mssql_bind($pro c, "@NTAccountLogi n", $login, SQLCHAR);
    > mssql_bind($pro c, "@StaffID", &$staffid, SQLINT2, TRUE);
    >
    > $result = mssql_execute ($proc);
    >
    > echo "STAFFID - ".$staffid."<br >";
    > --------------------------------------------------------------------------------------------------------------
    >
    > Thank you in advance.....[/color]

    Comment

    Working...