2
我想要得到的唯一ID上次插入行的存儲過程裏面,我作出這樣獲取的唯一ID上次插入行
DELIMITER //
CREATE PROCEDURE addNewUsers(IN userName varchar(128),IN password varchar(128), IN addedBy INT)
BEGIN
DECLARE id int default 0;
id = mysqli_insert_id (insert into `system_users`(`username`,`password`) values (userName ,md5(password)));
IF id <> 0 THEN
insert into `user_profile`(`full_name`,`Date_time_ added`,`added_by`) values (userName ,CURRENT_TIMESTAMP(),addedBy) where `user_id`=id ;
END IF
END //
DELIMITER ;
此錯誤發生
#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 '= mysqli_insert_id (insert into `system_users`(`username`,`password`) values (' at line 7
我懷疑這是從mysqli_insert_id
,我該怎麼辦?
Huuuuuuuuuuuge感謝名單 – palAlaa 2012-04-25 07:22:40
,救我工作的時間。 – vietnguyen09 2016-01-12 15:33:26