Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow How to generate network diagram?

    Hi, I'm Rane and I need some helps!

    I have a member table in MySQL database. Each member have a 'referralID' which indicate their respective referral. The 'referalID' is refer to 'MemberID' field, that is, the referalID must be an existed valid MemberID in the table.

    For example: C is a new member, his referal is B who have 5 subsidiary(C,D,E,F,G). B's referal is A and so on and so forth.


    A
    |
    B
    _______|_________
    | | | | |
    C D E F G


    Now I have to write PHP program to retrieve these information from the database and draw the network diagram to the browser(by automatically).

    I'd write the code to retrieve all members form the table and now I'd stuck here for a day!

    Please do help me! Thank you.

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you know what you've got in the database (by the way, a member that has no referralId, what value is stored there? That's important..).

    What you need is a data structure in PHP called a graph to store the data in your database. You want to have a method of adding to the graph the relations in your database (ie. you need to add a node to your graph, and then add an edge between two nodes in the graph). Then you need a method of printing out the graph based on a root node in the graph.

    I don't know of classes off hand, but I'll take a look for you. But hopefully that gives you a better idea of what you're looking at. If you already knew this, and you're looking for a ready-made script waiting for you, that might not work out so well.

    Also try searching for things like family-trees (although this may limit a node to having only 2 referals.. but that shouldn't be too hard to modify), uml diagramers.. stuff like that.

    Good luck,
    Sadiq.

  • #3
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Thank You Sad69

    Dear Sad69, thanks for your reply.

    If a member do not have a ReferalID, the initial value will be 'CompanyName', which means that he/she is a immediate member of our company.

    I've ask a friend and he told me there is no way to display a large family tree/network diagram through the PC's screen and also to the printer.

    So now I'm thinking of discuss this issue with my supervisor and maybe I'll use another method to display it out.

    Thank you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •