note 36501 added to function.mssql-execute
| From: | eliseo at olografix dot org | Date: | Sun, 12 Oct 2003 14:23:46 +0000 |
| Subject: | note 36501 added to function.mssql-execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58342@lists.php.net to get a copy of this message | ||
After many attempt I resolved the return output of a store procedure on Win2003 box, MSSQL7 and PHP
4.3.
I have problem to process the result from store procedure strCheckUser, and I must to set a R
variable, that must be returned from the last select operation (Select @R as R) see below.
----------------------------
/*
Store procedure to CheckUser Exist
*/
CREATE PROC strCheckUser
(
@AccountLO varchar(20) ,
@PasswordLO varchar(20)
)
AS
BEGIN
DECLARE @R INT
IF (SELECT count(*) as count FROM tbl_users WHERE AccountLO = @AccountLO and PasswordLO=@PasswordLO
) = 0
SET @R = '0'
END
BEGIN
IF (SELECT count(*) as count FROM tbl_users WHERE AccountLO = @AccountLO and PasswordLO=@PasswordLO
) = 1
SET @R = '1'
END
Select @R as R
GO
-------------------------
This is the php page
<?
.....
.....
$AccountLO="myuser";
$PassowrdLO="mypass";
$result=mssql_query("strCheckUser ".$AccountLO.", ".$PasswordLO."");
//echo gettype($result);
$arr = mssql_fetch_assoc($result);
echo $arr["R"];
......
......
?>
No $arr["R"] print 1 if the user exist and 0 if no exist
Thanks to duarte at uma dot pt for the suggestion
Bye eliseo@olografix.org
----
Manual Page -- http://www.php.net/manual/en/function.mssql-execute.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36501
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36501&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36501&report=yes
Search -- http://master.php.net/manage/user-notes.php