CodeIgniter Forums
passing special character to MySQL SP - 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: passing special character to MySQL SP (/showthread.php?tid=53705)



passing special character to MySQL SP - El Forum - 08-04-2012

[eluser]dinomycle[/eluser]
i am calling a stored procedure like below in my CI +MySQL web application

Code:
$id = 3;
        $name = "ABC_(CDE)";
$sql = "call getInfo(?,?);" ;
$query=$this->db->query($sql,array($id,$name));

but i was not getting the any query result, after enabling mysql debug, below code was getting passed to the MySQL SP

Quote:518 Query call getInfo('3','ABC_(CDE)')

so i believe the SP is searching for the string with html encoding. How to pass the variable without html encoding when i call the $this->db->query()

thanks for the help
dino


passing special character to MySQL SP - El Forum - 08-04-2012

[eluser]Aken[/eluser]
You cannot disable query escaping when using binds. You'll have to use $this->db->query() without it.


passing special character to MySQL SP - El Forum - 08-05-2012

[eluser]dinomycle[/eluser]
hello aken
thanks for the reply....
means, can u explain ..i am not an expert in this... how should i do this

there is difference in what i told before...
if i put $name = "ABC_(CDE)"; it works when i pass to the SP...but in my actual code, $name is coming as a function argument and i pass it directly to the SP...in this condition only the problem coming...

Code:
function1($name)
{
  $id = 3;
        
$sql = "call getInfo(?,?);" ;
$query=$this->db->query($sql,array($id,$name));
}
so when i checked the string length of the $name it is coming as 17 and if i do $name = "ABC_(CDE)"; coming as 9... so is it because of some UTF encoding ???

thanks for support
dino


passing special character to MySQL SP - El Forum - 08-06-2012

[eluser]Aken[/eluser]
It could be.


passing special character to MySQL SP - El Forum - 09-17-2012

[eluser]dinomycle[/eluser]
if i use the active record method also i get the same issue , can someone help me out

thanks for the help
dinomycle