GWibisono

okay free_result mungkin berguna

Feb 16th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $this->db->query("SET @q=''"); //set q variable
  3.  
  4. $sql    = "CALL some_procedure('$param1','$param2','$offset','$length',@q)"; //Call procedure
  5.  
  6. $arr['query']   = $this->db->query($sql) or die($this->db->error);
  7.            
  8. $sql    = "SELECT @q as q"; //select out parameter (@q) dari some_procedure
  9. /*
  10. If you are getting this error:
  11. Internal SQL Bug: 2014, Commands out of sync; you can't run this command now
  12.  
  13. 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.
  14. */         
  15. $this->db->free_result();
  16. $qry    = $this->db->query($sql) or die($this->db->error);
  17. // muncul #2014 Commands out of sync; you can't run this command now
  18. $row    = $qry->fetch_object();
  19. /*
  20. bisa juga pake Free atau close
  21. */
Add Comment
Please, Sign In to add comment