Posts

Showing posts with the label codeigniter

CodeIgniter: Call multiple queries from a MySQL stored procedure

If you are using CodeIgniter and wondering how are you going to execute such queries multiplied in greater than 1 times. So let say you have this MySQL stored procedure, DELIMITER // DROP PROCEDURE IF EXISTS multiples;// CREATE PROCEDURE multiples( param1 INT, param2 INT ) BEGIN SELECT * FROM table_a where key=param1; SELECT * FROM table_b where key=param2; END; // Now, your main goal is to grab the result set that the selection from table_a and table_b will be fetched. MySQL has the ability to fetch multiple queries in a stored procedure  (or see http://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html). Now in CodeIgniter, I'll just have a simple snippet here, public   function  getMultipleQuery ( )   {              $k   =   0 ;              $arr_results_sets   =   array ( ) ;              /* ...

CodeIgniter: Using Data Abstraction Layer (DAL)

Image
I just wanted to show how we do using a DAL to separate database queries from application layer business logic.