title: Classes function Menu Loop from DB
body: <p><br>
  I need some help with fixing my class. It used to be in a function but i'm actually setting all my functions into classes. And now somehow it is not working anymore im trying to change stuff but i don't know where the problem is now i think i have to return something now but i don't know how or what.<br><br>
  This is the class now with the function within:</p>
  
  <pre><code>class Menu{
  private $db;
  
  public function __construct($database) {
      $this-&gt;db = $db;
  }       
  // Loop Menu
  public function loop_array($array = array(), $pParent = 0){
      if (!empty($array[$pParent])){
          echo "&lt;ul&gt;";
              foreach ($array[$pParent] as $items){
                  echo "&lt;li&gt;". $items['pTitle'];
                  loop_array($array, $items['Page_id']);
                  echo "&lt;/li&gt;";
              }
          echo "&lt;/ul&gt;";
      }
  }
  // Echo  Menu
  public function display_menus_show(){
      global $db;
  
      $query = $db-&gt;prepare("SELECT * FROM Page");
      $array = array();
      if (mysql_num_rows($query)){
          while ($rows = mysql_fetch_array($query)){
              $array[$rows['pParent']][] = $rows;
          }
          loop_array($array);
      }
  }
  </code></pre>