I use SQL server2008 as a database, and I wrote a stored procedure in MSSQL Server 2008 . It works great in MSSQL Server 2008 . I want to call this stored procedure from codeigniter . To do this, I wrote the code as follows:
phpService.php:
public function Login($username, $password) { $this->load->model('Apimodel'); $result = $this->Apimodel->Login($username,$password); header('Content-type: application/json'); echo json_encode(array('LoginResponce'=>$result)); }
apimodel.php:
function Login($UserName,$Password) { $this->db = $this->GetDB(); $query = $this->db->query("EXEC Login"); return $query->result(); }
when I execute a procedure without a parameter Works fine
function Login($UserName,$Password) { $this->db = $this->GetDB(); $query = $this->db->query("EXEC Login '$UserName','$Password'"); return $query->result(); }
But when I execute the procedure with the parameter, it does not work
Can anyone tell me what I'm missing here?
Thank you in advance
source share