php - Get values from Select statement and Insert them in Temp table Stored procedure -


here stored procedure.

here want select data table save in variable insert in other variable.but here select statement has where. in value day should come loop. means in loop dayname(datetime) particular day. on basis of want fetch values , use in insert statement.

drop procedure if exists home_cleaner.getavailabledateandtime;  create procedure home_cleaner.`getavailabledateandtime`(datetime date)   begin   declare datetime               datetime default now();   declare datetimecounter        int default 0;   declare datetimecounterlimit   int default 90;   declare result                 varchar(255) default null;   declare result1                varchar(255) default null;   declare result2                varchar(255) default null;   declare result3                varchar(255) default null;   declare result4                varchar(255) default null;    declare      c cursor select group_concat(                             cleaner_calender.from,                             "-",                             cleaner_calender.to)                             result                     cleaner_calender                    day = dayname(datetime) , status = "1";      drop table if exists foo;   create table foo   (      id         int unsigned not null auto_increment primary key,      date1      date null,      daynamep   varchar(20) null,      timings    varchar(255) null   )   engine = innodb;  open c;   while datetimecounter < datetimecounterlimit        // here want fetch result1 datetime incrementing      fetch c result1;       insert foo(date1, daynamep, timings)      values (datetime, dayname(datetime), result1);       set datetime = date_add(datetime, interval 1 day);      set datetimecounter = datetimecounter + 1;   end while;      close c;  select * foo; end; 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -