How we can use mysql_affected_rows()
in stored procedure..
example
BEGIN
DECLARE countRow INT;
DECLARE roomTypeId INT;
INSERT INTO room_type (room_type)
SELECT * FROM (SELECT paramRoomType) AS tmp
WHERE NOT EXISTS (
SELECT room_type_id FROM room_type WHERE room_type = paramRoomType
) LIMIT 1;
SET countRow = ROW_COUNT();
IF(countRow > 0) THEN
SET roomTypeId = LAST_INSERT_ID();
INSERT hotel_has_room_type (hotel_id,room_type_id) VALUES (paramHotelId,roomTypeId);
END IF;
END