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.

Recommended Answers

All 3 Replies

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

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);

            }
        }
        }
}

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.