By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,335 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,335 IT Pros & Developers. It's quick & easy.

Strange values returned from Stored Procedure

P: n/a
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","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.....

Jun 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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:
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","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.....


Jun 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.