I have made this stored procedure
DELIMITER //
DROP PROCEDURE IF EXISTS find_max;
CREATE PROCEDURE find_max
(IN type INT,OUT maxx INT)
BEGIN
SELECT max(card_id)+1 INTO maxx FROM cards;
END;
//
DELIMITER;
and i want to have this stored procedure
DELIMITER //
DROP PROCEDURE IF EXISTS add_card;
CREATE PROCEDURE add_card
(var_member_id INT,var_card_number VARCHAR(16),var_code INT,var_expireday INT,var_expireyear INT, var_type INT)
BEGIN
INSERT INTO cards (member_id,card_number,code,expireday,expireyear,type,card_id,valid) VALUES (var_member_id,var_card_number,var_code,var_expireday,var_expireyear,var_type,var_card_id,1);
END;
//
DELIMITER;
where var_card_id will be the value that return the procedure find_max
How i can do this?
Thank you very!!