Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $this->db->query("SET @q=''"); //set q variable
- $sql = "CALL some_procedure('$param1','$param2','$offset','$length',@q)"; //Call procedure
- $arr['query'] = $this->db->query($sql) or die($this->db->error);
- $sql = "SELECT @q as q"; //select out parameter (@q) dari some_procedure
- /*
- If you are getting this error:
- Internal SQL Bug: 2014, Commands out of sync; you can't run this command now
- Then you never called mysqli_result::free(), mysqli_result::free_result(), mysqli_result::close(), or mysqli_free_result() in your script, and must call it before executing another stored procedure.
- */
- $this->db->free_result();
- $qry = $this->db->query($sql) or die($this->db->error);
- // muncul #2014 Commands out of sync; you can't run this command now
- $row = $qry->fetch_object();
- /*
- bisa juga pake Free atau close
- */
Add Comment
Please, Sign In to add comment