CodeIgniter Forums
Need Help to call the Stored Procedures in CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need Help to call the Stored Procedures in CodeIgniter (/showthread.php?tid=38360)



Need Help to call the Stored Procedures in CodeIgniter - El Forum - 02-06-2011

[eluser]Tamilmani[/eluser]
Hi,

I am using SQLSRV driver in codeigniter. My back end connection is SQL Server.

I am not able run my Stored Procedure in Codeigniter.The result set is nothing.

My Example:

$userid=5;
$sp ="exec UP_User_getDetails $userid";

$query=$this->db->query($sp);
return $query->result();

Please any one tell me , whether my code is correct or not . If anything wrong in my code. Please update me . I will correct my side or else any one suggest me good solution for this.

Thanks
Tamilmani Mohan


Need Help to call the Stored Procedures in CodeIgniter - El Forum - 06-22-2011

[eluser]Andrei VISAN[/eluser]
Hi,

You are sending the parameter the wrong way.

Your code should look like this:

Code:
$userid=5;
$sp =“exec UP_User_getDetails @userid=”.$userid;

$query=$this->db->query($sp);
return $query->result();

Where @userid is your stored procedure's parameter.