Page 1 of 1

unknown error

Posted: Mon Apr 30, 2007 7:44 am
by mad_phpq
Warning: mysqli::prepare() [function.mysqli-prepare]: All data must be fetched before a new statement prepare takes place in menu.class.php on line 185

Code: Select all

function GetByParent ( $parent_id, $menu_id )
		{
		
			global $mysqli;
			
			var_dump($menu_id);
			
LINE 185	                $stmt = $mysqli->prepare("call menu_itemsGetByParen_proc(?)");
			$stmt->bind_param("ii", $parent_id, $menu_id);
			$stmt->execute();			

			$aRet = array();
			
			while ( $row = $stmt->fetch() ){
				$clObject = new menu_itemsInfo ( $row["id"], $row["menu_id"], $row["parent_id"], $row["menu_item_name"], $row["url"], $row["accesskey"] );
				array_push ( $aRet, $clObject );
			}
		
			$stmt->close();

Posted: Mon Apr 30, 2007 7:53 am
by feyd
You haven't read all the result data.

Posted: Mon Apr 30, 2007 7:58 am
by mad_phpq
would you know why it hasnt. Is there a function i can use to clear the data.... or do i have to open a different connection?

Posted: Mon Apr 30, 2007 8:28 am
by volka
You probably have another (prepared) statement in your script that is still active (and has unread data) when GetByParent is called.
And yes, there is a function to clear the data, http://de2.php.net/manual/en/function.m ... -close.php
You're already using it for the statement in GetbyParent, $stmt->close()

Posted: Mon Apr 30, 2007 9:44 am
by mad_phpq
i have a stmt->close() in every function.

Posted: Mon Apr 30, 2007 9:57 am
by RobertGonzalez
There is a chance that it is not closed prior to this function call, as $mysqli is globalized.

Posted: Mon Apr 30, 2007 10:45 am
by mad_phpq
ok. thanks. I think i'll have to go back to the drawing board then. Thanks for your help.

While, i'm here, does anyone know any good php/mysql stored procedures code samples?

Posted: Mon Apr 30, 2007 11:00 am
by RobertGonzalez
What is the procedure trying to do? I have a few, but like PHP, it is better to know what you want done that to throw out guesses without knowing.