我有这个存储过程
DELIMITER $$
DROP PROCEDURE IF EXISTS RegisterUser$$
CREATE PROCEDURE `RegisterUser`(IN `username` VARCHAR(30), IN `password` VARCHAR(30), IN `firstname` VARCHAR(25), IN `lastname` VARCHAR(30), IN `email` VARCHAR(35))
BEGIN
INSERT INTO users
(
username,
password,
firstname,
lastname,
email
)
VALUES
(
@username,
@password,
@firstname,
@lastname,
@email
);
END $$
DELIMITER ;
每当我尝试在PHPmyadmin或PHP代码中执行此操作时,都不会插入任何记录并且不会出现错误。谢谢你的帮助!
答案 0 :(得分:1)
请勿使用@
,因为您的参数也没有。{/ p>
DELIMITER $$
DROP PROCEDURE IF EXISTS RegisterUser$$
CREATE PROCEDURE `RegisterUser`(IN `uname` VARCHAR(30), IN `pass` VARCHAR(30), IN `first` VARCHAR(25), IN `last` VARCHAR(30), IN `mail` VARCHAR(35))
BEGIN
INSERT INTO users (username, password, firstname, lastname, email)
VALUES (uname, pass, first, last, mail);
END $$
DELIMITER ;
使用与列名不同的参数名称以避免错误。