Loading ...
Sorry, an error occurred while loading the content.

help to built PHP tree view

Expand Messages
  • shah alom
    Hello Everybody, Currently I am working on a project that needed MLM structure tree view. Can anybody give me any resource to built that using PHP with
    Message 1 of 4 , Mar 2, 2012
    • 0 Attachment
      Hello Everybody,
      Currently I am working on a project that needed MLM structure tree view. Can anybody give me any resource to built that using PHP with supporting language.
       

      Thanks in Advance.

      Mohammad Shah Alom Hossain (Amin)
      +8801677073609

    • ratul
      Hi, i dont know what is your requirements. But here is a simple script to create tree view in PHP. function get_children($parent, $level = 1) { $result_p =
      Message 2 of 4 , Mar 5, 2012
      • 0 Attachment
        Hi,

        i dont know what is your requirements. But here is a simple script to create tree view in PHP.

        function get_children($parent, $level = 1) {
            $result_p = mysql_query('SELECT * FROM your_tree WHERE parent_id = '.$parent);
            if(mysql_num_rows($result_p) > 0) {
                echo '<ul>';
                    while($rows_p = mysql_fetch_array($result_p)) {
                        echo '<li>'.$rows_p['title'].'</li>';
                        get_children($rows_p['id'], $level+1);
                    }
                echo '</ul>';
            }
        }
        mysql_connect('localhost', 'root', "");
        mysql_select_db('treeview');

        $result = mysql_query('SELECT * FROM your_tree where parent_id = 0');
        //echo '<pre>';print_r($rows);echo '</pre>';
        if(mysql_num_rows($result) > 0) {
            echo '<ul>';
                while($rows = mysql_fetch_array($result)) {
                    echo '<li>'.$rows['title'].'</li>';
                    get_children($rows['id']);
                }
            echo '</ul>';
        }
        else echo 'No Items';

        Just create a table your_tree(id, parent_id, title). The function get_children() will be called recursively through all table rows.

        If you need more help, you can contact with me in IM or search in google for more help.

        Thanks-
        Ratul.
        Web Programmer, Aan-nahl.
        www.aan-nahl.com 
        www.asefratul.me



        --- In phpexperts@yahoogroups.com, shah alom <salom_amin@...> wrote:
        >
        > Hello Everybody,
        > Currently I am working on a project that needed MLM structure tree view. Can anybody give me any resource to built that using PHP with supporting language.
        >  
        >
        > Thanks in Advance.
        >
        > Mohammad Shah Alom Hossain (Amin)
        > +8801677073609
        >
        > http://tutpub.com
        >
      • Amin
        Thank You Ratul for your reply, I got the the concept from your example script.....
        Message 3 of 4 , Mar 6, 2012
        • 0 Attachment
          Thank You Ratul for your reply,
          I got the the concept from your example script.....





          --- In phpexperts@yahoogroups.com, "ratul" <raaatuuul@...> wrote:
          >
          > Hi,
          >
          > i dont know what is your requirements. But here is a simple script to
          > create tree view in PHP.
          >
          > function get_children($parent, $level = 1) {
          > $result_p = mysql_query('SELECT * FROM your_tree WHERE parent_id =
          > '.$parent);
          > if(mysql_num_rows($result_p) > 0) {
          > echo '<ul>';
          > while($rows_p = mysql_fetch_array($result_p)) {
          > echo '<li>'.$rows_p['title'].'</li>';
          > get_children($rows_p['id'], $level+1);
          > }
          > echo '</ul>';
          > }
          > }
          > mysql_connect('localhost', 'root', "");
          > mysql_select_db('treeview');
          >
          > $result = mysql_query('SELECT * FROM your_tree where parent_id = 0');
          > //echo '<pre>';print_r($rows);echo '</pre>';
          > if(mysql_num_rows($result) > 0) {
          > echo '<ul>';
          > while($rows = mysql_fetch_array($result)) {
          > echo '<li>'.$rows['title'].'</li>';
          > get_children($rows['id']);
          > }
          > echo '</ul>';
          > }
          > else echo 'No Items';
          >
          > Just create a table your_tree(id, parent_id, title). The function
          > get_children() will be called recursively through all table rows.
          >
          > If you need more help, you can contact with me in IM or search in google
          > for more help.
          >
          > Thanks-
          > Ratul.
          > Web Programmer, Aan-nahl.
          > www.aan-nahl.com <http://www.aan-nahl.com>
          > www.asefratul.me <http://asefratul.me>
          >
          >
          >
          > --- In phpexperts@yahoogroups.com, shah alom <salom_amin@> wrote:
          > >
          > > Hello Everybody,
          > > Currently I am working on a project that needed MLM structure tree
          > view. Can anybody give me any resource to built that using PHP with
          > supporting language.
          > >
          > >
          > > Thanks in Advance.
          > >
          > > Mohammad Shah Alom Hossain (Amin)
          > > +8801677073609
          > >
          > > http://tutpub.com
          > >
          >
        • ratul
          Its my pleasure :D.
          Message 4 of 4 , Mar 12, 2012
          • 0 Attachment
            Its my pleasure :D.

            ..............


            --- In phpexperts@yahoogroups.com, "Amin" <salom_amin@...> wrote:
            >
            > Thank You Ratul for your reply,
            > I got the the concept from your example script.....
            >
            >
            >
            >
            >
            > --- In phpexperts@yahoogroups.com, "ratul" <raaatuuul@> wrote:
            > >
            > > Hi,
            > >
            > > i dont know what is your requirements. But here is a simple script to
            > > create tree view in PHP.
            > >
            > > function get_children($parent, $level = 1) {
            > > $result_p = mysql_query('SELECT * FROM your_tree WHERE parent_id =
            > > '.$parent);
            > > if(mysql_num_rows($result_p) > 0) {
            > > echo '<ul>';
            > > while($rows_p = mysql_fetch_array($result_p)) {
            > > echo '<li>'.$rows_p['title'].'</li>';
            > > get_children($rows_p['id'], $level+1);
            > > }
            > > echo '</ul>';
            > > }
            > > }
            > > mysql_connect('localhost', 'root', "");
            > > mysql_select_db('treeview');
            > >
            > > $result = mysql_query('SELECT * FROM your_tree where parent_id = 0');
            > > //echo '<pre>';print_r($rows);echo '</pre>';
            > > if(mysql_num_rows($result) > 0) {
            > > echo '<ul>';
            > > while($rows = mysql_fetch_array($result)) {
            > > echo '<li>'.$rows['title'].'</li>';
            > > get_children($rows['id']);
            > > }
            > > echo '</ul>';
            > > }
            > > else echo 'No Items';
            > >
            > > Just create a table your_tree(id, parent_id, title). The function
            > > get_children() will be called recursively through all table rows.
            > >
            > > If you need more help, you can contact with me in IM or search in google
            > > for more help.
            > >
            > > Thanks-
            > > Ratul.
            > > Web Programmer, Aan-nahl.
            > > www.aan-nahl.com <http://www.aan-nahl.com>
            > > www.asefratul.me <http://asefratul.me>
            > >
            > >
            > >
            > > --- In phpexperts@yahoogroups.com, shah alom <salom_amin@> wrote:
            > > >
            > > > Hello Everybody,
            > > > Currently I am working on a project that needed MLM structure tree
            > > view. Can anybody give me any resource to built that using PHP with
            > > supporting language.
            > > >
            > > >
            > > > Thanks in Advance.
            > > >
            > > > Mohammad Shah Alom Hossain (Amin)
            > > > +8801677073609
            > > >
            > > > http://tutpub.com
            > > >
            > >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.