Code:
SELECT COUNT(*), full_name, access_level
FROM users
JOIN access_levels
ON users.access_level_id=access_levels.id
WHERE users.active=1
AND username="admin"
AND password="pwd";
The above query returns the expected result.
I have created the following stored procedure
Code:
sp_authUser`(IN username VARCHAR(255), IN password VARCHAR(255), OUT full_name VARCHAR(255), OUT access_level VARCHAR(255))
BEGIN
SELECT users.full_name, access_levels.access_level
FROM users
JOIN access_levels
ON users.access_level_id=access_levels.id
WHERE users.active=1
AND users.username=username
AND users.password=password;
I have tried like 10 different queries and procedure declarations - even without any IN/OUT params. I keep getting the same error:
#1312 - PROCEDURE cis279JAVA.sp_authUser can't return a result set in the given context
Here's how the procedure works:
I pass it 2 strings, username & password.
It returns 2 strings, full_name & access_level for any user who is active (users.active=1).
I don't think I can SSH to the server so I can't test whether I am getting this error because I am using phpMyAdmin. Anyone see what I'm doing wrong within the procedure?
I am executing it from an SQL window by:
Code:
CALL sp_authUser("admin", "pwd", @full_name, @access_level);
Bookmarks