Reputation: 7144
I'm trying to execute the following query:
DELIMITER $$
USE user_access
CREATE PROCEDURE check_user_login(IN username VARCHAR(50),IN `password` VARCHAR(50))
BEGIN
SELECT 1
FROM user_access
WHERE UserName='$username' AND `Password`='$password'
END$$
DELIMITER ;
But getting this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE PROCEDURE check_user_login(IN username VARCHAR(50),IN `password` VARCHAR(' at line 2
What's wrong with the query?
Upvotes: 1
Views: 1471
Reputation: 13247
You missed the ;
in two places.
DELIMITER $$
USE user_access; -- you missed the semicolon
CREATE PROCEDURE check_user_login(IN username VARCHAR(50), IN `password` VARCHAR(50))
BEGIN
SELECT 1
FROM `user_access`
WHERE UserName = username AND `Password` = `password`; -- you missed the semicolon
END$$
DELIMITER ;
Upvotes: 0
Reputation: 41867
Looks to me like there's no separation between use user_access
and create procedure
, perhaps this will help you along:
USE user_access;
DELIMITER $$
CREATE PROCEDURE ...
also, your parameter syntax looks wrong to me, you don't want '$username'
just username
should do as it is the name of your parameter.
Upvotes: 1