Strange values returned from Stored Procedure

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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

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","something");
mssql_select_db("dev", $link_id);

$proc = mssql_init("spGetWhoAmILoggedInAs", $link_id);

$login = "LGROUP\J_BLOGGS";

mssql_bind($proc, "@NTAccountLogin", $login, SQLCHAR);
mssql_bind($proc, "@StaffID", &$staffid, SQLINT2, TRUE);

$result = mssql_execute ($proc);

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

Thank you in advance.....

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:
Quoted text here. Click to load it

Site Timeline