I am trying to use a prepared MySQL statement after retrieving the results from a previous query (it's for a multi-level menu). The first query works fine, but the second query does not. I have tried using mysqli_stmt::reset and mysqli_stmt::close, but had no luck with those either. Lastly, the only time I receive error messages is when I use mysqli_stmt::close. The code I am currently using is: [code] $l1_parent = 0; $retrieve_menu->bind_param("i", $l1_parent); $retrieve_menu->execute(); $retrieve_menu->bind_result($menu_id, $menu_item, $menu_cmd); $level1 = array(); while ($retrieve_menu->fetch()) { $level1_item = array(); array_push($level1_item, $menu_id); array_push($level1_item, $menu_item); array_push($level1_item, $menu_cmd); array_push($level1, $level1_item); } $retrieve_menu->free_result(); $level1_counter = 0; echo "<ul>"; for ($level1_counter = 0; count($level1) >= $level1_counter; $level1_counter++) { echo "<li><a href=\"https://myserver/?sid=$GENSID&uid=$GETUID&cmd=" . $level1[$level1_counter][2] . "\" class=\"" . $level1[$level1_counter][2] . "\">" . $level1[$level1_counter][1] . "</a></li>"; $l2_parent = $level1[$level1_counter][0]; $retrieve_menu->bind_param("i", $l2_parent); $retrieve_menu->execute(); $retrieve_menu->bind_result($menu_id, $menu_item, $menu_cmd); $level2 = array(); while ($retrieve_menu->fetch()) { $level2_item = array(); array_push($level2_item, $menu_id); array_push($level2_item, $menu_item); array_push($level2_item, $menu_cmd); array_push($level2, $level2_item); } $retrieve_menu->close(); if (count($level2) > 0) { echo "<ul>"; echo "<li><a href="/">$level2 " . $level1[$level1_counter][0] . "</a></li>"; echo "</ul>"; } } echo "</ul>"; [/code] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php