Make a stored function to search for a user given the user's username & password. Arguments to the function: username & password | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Make a stored function to search for a user given the user's username & password. Arguments to the function: username & password

the function must return true if it exists false if it doesn't. Tried a couple of things but I'm still getting some errors using MySQL.

23rd Oct 2017, 3:00 PM
lightsoff
2 Answers
+ 1
Hi can i see some of the code to be able to help out please.
23rd Oct 2017, 3:09 PM
ihateonions
0
Thanks for taking your time to look into this by the way :) delimiter $ create function cred(u varchar(15), p varchar(6)) returns char(5) DETERMINISTIC begin declare a CHAR(5); if (select username = u and pwd = p from customers) then set a = 'true'; else set a = 'false'; end if; end$ delimiter ; select cred('dJete', 'abc112');
23rd Oct 2017, 4:56 PM
lightsoff