Custom Function Call |
[eluser]GPC[/eluser]
Hello people, I have the following problem: I have a function in my database and every time I call it from my model this way: Code: $consulta = $this->db->call_function('existe_padre', $rut, $parentesco); I get the following error: Quote:A Database Error Occurred So my question is what this error means.. By the way if I call it this way: Code: $consulta = $this->db->query("SELECT existe_padre('$rut','$parentesco') as resultado"); I don't get the error.. :-S Another question.. How can I pass an array to this query Code: $consulta = $this->db->query("SELECT existe_padre('$rut','$parentesco') as resultado"); Because basically I wanna do this: Code: $consulta = $this->db->call_function('existe_padre', $datos); Where $datos is an array that contains all the information that I want. Ps: I know my English is not very good so I apologize for that. Ps1: I'm using mysql 5.1.40
[eluser]danmontgomery[/eluser]
call_function() calls a php function, not a mysql function. http://ellislab.com/codeigniter/user-gui...ction.html
[eluser]GPC[/eluser]
Wow my bad.. Thanks! So how can I do what I want.. I was trying to do this.. Code: $sql = "SELECT existe_padre(?) AS resultado"; And I get this error Quote:Error Number: 1318 I know that are the single quotes because I know It will be something like this Code: SELECT existe_padre(333333, padre) AS resultado So how can I do it??
[eluser]danmontgomery[/eluser]
Try: Code: $sql = "SELECT existe_padre(?,?) AS resultado";
[eluser]GPC[/eluser]
That didn't work, but this works! Code: $sql = 'SELECT existe_padre(\''.implode('\',\'', $test).'\') AS resultado'; Thanks by the way! |
Welcome Guest, Not a member yet? Register Sign In |