I am running a server with cPanel and mysql and phpmyadmin and its all uptodate. So what I am doing is I am hosting a website and they need stored PROCEDURE for there db. I have never done any thing with stored PROCEDURE so I got no idea what I am doing! I am not sure how to add or if it is even right.
'BEGIN
DECLARE done INT DEFAULT 0;
DECLARE raid_count_60 int;
DECLARE raid_count_30 int;
DECLARE individualraid int;
DECLARE individualraid_30 int;
DECLARE percent int;
DECLARE membername varchar(100);
DECLARE start_Date int;
DECLARE Curr_Date int;
DECLARE first_raid int;
DECLARE curr1 CURSOR for SELECT member_name from eqdkp_members;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN curr1;
REPEAT
FETCH curr1 into membername;
IF NOT done then
Set Curr_Date =UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL 60 DAY)) ;
Select member_firstraid into first_raid from eqdkp_members where member_name= membername;
IF first_raid > Curr_Date then
set Curr_Date = first_raid;
END if;
SELECT count(*) into raid_count_60 FROM eqdkp_raids
WHERE Curr_Date <= raid_date ;
select count(*) into individualraid
FROM eqdkp_raids r, eqdkp_raid_attendees ra
WHERE (ra.raid_id = r.raid_id)
AND (ra.member_name= membername )
and Curr_Date <= raid_date ;
Set Curr_Date =UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL 30 DAY)) ;
IF (first_raid> Curr_Date) then
set Curr_Date = first_raid;
END if;
SELECT count(*) into raid_count_30 FROM eqdkp_raids
WHERE Curr_Date <= raid_date ;
select count(*) into individualraid_30
FROM eqdkp_raids r, eqdkp_raid_attendees ra
WHERE (ra.raid_id = r.raid_id)
AND (ra.member_name= membername )
and Curr_Date <= raid_date ;
update eqdkp_members
set Raids60 =round(individualraid - raid_count_60 * 100),
Raids30 =round(individualraid_30 - raid_count_30 * 100)
where member_name =membername;
END IF;
UNTIL done END repeat;
CLOSE curr1;
delete from report_date;
-- select null;
insert into report_date value (Now());
select 1 into individualraid;
so what I need to know is...is that right will it work and how do I add it? Help would be nice