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.

  1. block of code accepts user input(here title, severity, opendate, closedate) , insert 1 row.

  2. 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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -