MyBB Community Forums

Full Version: HELP WHERE IS MY ERROR
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I read than when I have query for a STORE PROCEDURE I should to use multi_query instead of query, BUT WHERE IS MY ERROR

myfile.php
<?php
    

define('IN_MYBB', 1);

//$templatelist="TD_Clasif,TD_clasif_colapsa,TD_clasif_sinjs";
require_once '../FORO/global.php';
$sql="CALL BUSCAR('%%',0,9900,'','DESC',0,0,0,'00');";
//$db->multi_query($sql);
if ($db->multi_query($sql))
{
  do
    {
    // Store first result set
    if ($result=$db->store_result($sql))
      {
      while ($filas=$db->fetch_array($result))
        {
        $html.=$filas['PRODUCTO'];
        }
      $db->free_result();
      }
    }
  while ($db->next_result());
}

eval("\$page = \"".$templates->get("TD_AJAX")."\";");
output_page($page);  
?>

db_mysqli.php I added this

	function next_result(){
		@mysqli_next_result($this->current_link);
	}

	function store_result($sql){
		@mysqli_store_result($this->current_link,$sql);	
	}
	function multi_query($sql){
		@mysqli_multi_query($this->current_link,$sql);
	}

But I have still the error

Quote:SQL Error:
2014 - Commands out of sync; you can't run this command now
Query:
SELECT template FROM mybb_templates WHERE title='TD_AJAX' AND sid IN ('-2','-1','1') ORDER BY sid DESC LIMIT 1

why was moved?