I don't think it will work this way. When you close the statement (e.g.
$menu_stmt->close();) you also deallocate the statement handle. So the second time through the loop you don't have the prepared statements available to work with anymore.
Try closing the statements after the loop has finished executing.