PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mad_phpq
Forum Commoner
Posts: 85 Joined: Fri Apr 27, 2007 5:53 am
Post
by mad_phpq » Mon Apr 30, 2007 7:44 am
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();
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Apr 30, 2007 7:53 am
You haven't read all the result data.
mad_phpq
Forum Commoner
Posts: 85 Joined: Fri Apr 27, 2007 5:53 am
Post
by mad_phpq » Mon Apr 30, 2007 7:58 am
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?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Apr 30, 2007 8:28 am
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()
mad_phpq
Forum Commoner
Posts: 85 Joined: Fri Apr 27, 2007 5:53 am
Post
by mad_phpq » Mon Apr 30, 2007 9:44 am
i have a stmt->close() in every function.
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Apr 30, 2007 9:57 am
There is a chance that it is not closed prior to this function call, as $mysqli is globalized.
mad_phpq
Forum Commoner
Posts: 85 Joined: Fri Apr 27, 2007 5:53 am
Post
by mad_phpq » Mon Apr 30, 2007 10:45 am
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?
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Apr 30, 2007 11:00 am
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.