I am using codeigniter, which has mysqli as the db driver, I am trying to call a simple stored procedure from my model, but I get an error. What am I doing wrong
Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'pc()' at line 1 pc() Filename: C:\hosted\saner.gy\ipa\system\database\DB_driver.php Line Number: 330
When I run the request call to the Stored Procedure, it works fine, but from codeigniter it throws the above error
Stored procedure
CREATE DEFINER=`root`@`localhost` PROCEDURE `pc`() LANGUAGE SQL NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' BEGIN SELECT * FROM tbl_flo WHERE name = 'sam'; END
controller
public function sp() { $this->User_model->pc(); }
Model
public function pc() { $query = $this->db->query("pc()"); return $query->result(); }
source share