I am trying to create a login in SQL and using stored procedures to capture the login information.
Even when executing the stored procedure on phpmyadmin, my out param is always returning Null, and I can’t figure out why.
userid
is my OUT param, I am getting back an email and password and the rest of the fields are empty strings.
BEGIN
set @userid = (select id from `user` where `email` = email and `password` = password and statusId = 8);
if @userid is not null
then
set @statu = 9;
elseif @userid is null
then
set @statu = 10;
end if;
call loginHistory(@userid, email, @statu, ip4, ip6, deviceType, appVer);
set @userid = userid;
END
Thanks
2
Answers
You have a problem with your parameters. Name them with a prefix, such as
in
.So I think you want:
I’m not sure if this will fix your problem, but at least the code will do something more sensible.
Change
to
userid
and@userid
are different things.If that does not suffice, show us the rest of the declaration.