mysql - Create Stored Procedures with PDO in PHP -


i reading text file php , trying execute commands it, creating db , tables , procedures has. code creates tables not create stored procedures given in file.

 delimiter $$  drop procedure if exists `add_hits`$$  create definer=`root`@`localhost` procedure `add_hits`( in id varchar(255))  begin  select hits @hits db_books book_id = id;  update db_books set hits=@hits+1 book_id = id;  end$$ 

the pdo not creating sps, how able accomplish task? have tried executing code part , line line, nothing works.
trying make db installer script.

well, pma helped me answering question of own.
overcome need remove delimiter part of procedure, queries become like:

 drop procedure if exists `add_hits`;  create definer=`root`@`localhost` procedure `add_hits`( in id varchar(255))  begin  declare hits_bk int;  select hits hits_bk db_books book_id = id;  update db_books set hits=hits_bk+1 book_id = id;  end; 

now queries work.
@your common sense , @riggsfolly helping out.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -