I am trying to run SP in phpmyadmin web-hosting server but always getting following error
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
SP I am trying to run is:
CREATE PROCEDURE Authenticate_UserByEmailID(strUsername VARCHAR(45), strPassword VARCHAR(45))
BEGIN
SELECT * FROM users
WHERE users.Username = strUsername AND users.Password = strPassword;
END $$
I tried putting single quotes in SP name, table name columns name and different other combinations with quotes but no result then I came across this link and tried changing delimiter but no result. can you please help on this.
Sorry guys my bad. I added delimiter which solved the problem for me.
DELIMITER ;;
CREATE PROCEDURE `Authenticate_UserByEmailID`(strUsername VARCHAR(45), strPassword VARCHAR(45))
BEGIN
SELECT * FROM DBCompany_samsonusac517644.users
WHERE Username = strUsername AND Password = strPassword;
END ;;
you miss the DELIMITER
mysql> delimiter $$
mysql> CREATE PROCEDURE Authenticate_UserByEmailID(strUsername VARCHAR(45), strPassword VARCHAR(45))
-> BEGIN
-> SELECT * FROM users
-> WHERE users.Username = strUsername AND users.Password = strPassword;
-> END $$
Query OK, 0 rows affected (0.01 sec)
All the answers above are making certain assumptions. There are basic problems in 1and1 and certain other hosting providers are using phpMyAdmin versions which are very old and have an issue that defined delimiter is ; and there is no way to change it from phpMyAdmin. Some of the providers have moved on so they will not face this problem. but if you do then following are the ways -
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.