I have the following code:
function menu($parent, $level){
global $dbc;
$result = $dbc->prepare('SELECT linktext, visible, sort FROM content WHERE parent =? ORDER BY sort');
$result->bind_param('s', $parent);
$result->execute();
$result->bind_result($menu_linktext, $menu_visible, $menu_sort);  
$total_records = $result->num_rows;
if($level > 0 && $total_records > 0){
echo '<ul>';
}
while($row = $result->fetch()){
echo "<li>";
echo '<a href="?page=' . $menu_linktext . '">' . $menu_linktext . '</a>'.$id;
//display this level's children
menu($id, $level+1);
echo "</li>\n";
}
if($level > 0 &&  $total_records > 0){
echo '</ul>';
 }
}
echo '<ul>' . menu(0,0) . '</ul>'
It works for one link (Home) then throws out a Call to a member function bind_param() on a non-object error.
The basics of the table is:
page | linktext | visable | parent | sort
  1       Home       1         0      1
  2      Gallery     1         0      3
  3     About Us     1         0      2
  4    Contact Us    1         0      5
  5     Services     1         0      4
  6     Diving       0         5      1
  7     Angling      0         5      2
  8     Charters     0         5      3
Here is the HTML structure:
 <ul class="sf-menu" id="nav">
          <li><a href="index.html">Home</a></li>
          <li><a href="about.html">Examples</a></li>
          <li><a href="gallery.html">A Page</a></li>
          <li><a href="#">Services</a>
            <ul>
              <li><a href="#">Diving</a></li>
              <li><a href="#">Angling</a>
              <li><a href="#">Charter</a></li>
            </ul>
          </li>
          <li><a href="contact.html">Contact Us</a></li>
        </ul>
I want to get the basic menu working then work on the sort order of the links.If anyone can help it would be very much appreciated.
