0

Hello,

In attachment image so i want to make Tree as output of PDF. i have built it but not exact. so can you make it some help if you know.

Thank You.

Attachments sample[1].jpg 39.42 KB
2
Contributors
3
Replies
23
Views
2 Years
Discussion Span
Last Post by broj1
0

Can you post the code you've done so far. And then more precisely describe what you want but were not able to do.

0

hello @broj,

here i am posting my code so can you suggest me in detail.

i have this recursion function and trying to make as above image.

this function displays tree in pdf, you can check image here.

function generate_pdf_tree($goat_name, $level)
{
    global $wpdb;
    $sql = $wpdb->prepare("SELECT * FROM mm_goats WHERE goat_name = %s", $goat_name);
        $rowgoat = $wpdb->get_row($sql, ARRAY_A);
        if(!empty($rowgoat))
        {
            if($rowgoat['sire'] != "" || $rowgoat['dam'] != "")
            {
            if($rowgoat['sire'] != "")
            {
                //»
                print "<br>".str_repeat("&nbsp;|", $level)."-SIRE: ".$rowgoat['sire'];
                generate_pdf_tree($rowgoat['sire'],$level + 1);

            }
            if($rowgoat['dam'] != "")
            {
                print "<br>".str_repeat("&nbsp;|", $level)."-DAM: ".$rowgoat['dam'];
                generate_pdf_tree($rowgoat['dam'],$level + 1);

            }
        }
        }
}
Attachments test.png 60.66 KB
0

Can you please post the table structure and some data so I (or anyone else) can do a test. Post the CREATE TABLE mm_goats ... statement and some INSERT INTO mm_goats ... statements so anyone willing to help does not have to make up all the test data.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.