Jump to content

[Solved]Why "Fatal error: Only variables can be passed by reference"?

- - - - -

  • Please log in to reply
No replies to this topic

#1
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 765 posts
Anyone can explain why am I getting "Fatal error: Only variables can be passed by reference in xxx\login.php on line 20"? Line 20 is the line I marked in the codes below.

Thanks in advance!



function UserLogin($UsrName, $UsrPwd)

{

	global $DBConn;


	if (!InitDBConn())

	{

		return false;

	}

		

	$Hash=md5($UsrPwd);

	$Result=1;

		

	// initialize login stored procedure

	$LoginProc=mssql_init('dbo.Login', $DBConn);

	// binding parameters for the stored procedure

	mssql_bind('@RETURN_VALUE', $Result, SQLINT2, false, false); // <<== Fatal error

	mssql_bind('@UsrName', $UsrName, SQLCHAR, false, false, 20);

	mssql_bind('@Hash', $Hash, false, false, 50);

	mssql_bind('@Token', $Token, SQLVARCHAR, true, true);

		

	mssql_execute(@LoginProc);

	

	return @Token;

}


[Edit]
Nevermind this. It turns out that I have missed the first required parameter (for each mssql_bind, I should pass $LogicProc for their first parameter).

Edited by LuthfiHakim, 03 April 2011 - 11:05 AM.
Found the problem





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users