View difference between Paste ID: 4X7G9NrL and wGXZV7zs
SHOW: | | - or go back to the newest paste.
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-
$qry	= $this->db->query($sql) or die($this->db->error); // muncul #2014 Commands out of sync; you can't run this command now
9+
/*
10-
$row	= $qry->fetch_object();
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
*/