MySQL has procedure and function feature. There is good article explaining both topics in http://bit.ly/dWDh9w.
To call mysql function from codeigniter, we can simply use query() function from database class. For example
$query = $this->db->query("call storedFunction($param1, $param2) as A"); $row = $query->row(); echo $row->A;
Where storedFunction is the name of function we have created before.
To call mysql stored procedure from codeigniter, we can use query() function from database class. For example
$query = "CALL hello('Chandra', @a)"; $res = $this->db->query($query); $query = "SELECT @a as A"; $res = $this->db->query($query); $row = $res->row();
Where hello is the name of stored procedure.
Hope this article helps 🙂
Leave a Reply