Mysql Stored procedure that accepts a date range from user and displays a list of open bugs -
i newbie mysql writing stored procedures , functions. faced lots of errors in writing code accepts user input , date time manipulation. have created table called 'bugs' below...
create table 'bugs' ( id int(11) not null auto_increment primary key, title varchar(20) not null, severity int not null check(severity>0 && sevirity<5), opendate datetime not null default current_timestamp, closedate datetime default null )engine=myisam default charset=latin1;
i want write below 2 things.
block of code accepts user input(here title, severity, opendate, closedate) , insert 1 row.
stored procedure accepts date range user , displays list of open bugs(for opendate between given date range , closedate beyond date range)
can me code?
you can write procedure :
1 . @ first call procedure php file(if have it) :
$report1=$db->query("call procedure_name('".$opendate."','".$closedate."')");
2 . write code in procedure file :
create definer = 'root'@'localhost' procedure db_name.procedure_name(in opendate varchar (15), in closedate varchar (15)) begin //write here mysql query end
Comments
Post a Comment