How to get Data into XMl Data from Database column to Html page or in Php file

207 views Asked by At

Hello I have a Sql Database table named as CaseInfo. Inside that table third column Contains Xml Datas(Huge File). I am trying to get data as and object or anything in php and wanted to show that into Html page. I have done follow code. this is the function where i want data from 3rd column which is named as EDITABLEL.

function get_case_id_details($caseId) {
            //TODO: Get these variables from some secure location or config file


    write_log("ITAP :Inside get_case_id_details Method ...");
            $username='acleee';
            $password='acleee';
            $host='10.172.82.48';
            $port='1521';
            $db='example';

            $db_details=$host . ':' . $port . '/' . $db;

            $conn = oci_connect($username,$password, $db_details);

            if (!$conn){
                            return $caseId;
              }

            $sql = "SELECT * FROM CASEINFO_DATA WHERE id ='$Id'";

            $stmt = oci_parse($conn, $sql);


            oci_bind_by_name($stmt,":id",$Id,2);


            oci_execute($stmt);

            while (($row = oci_fetch_object($stmt)) != false) {
            //fetching that object and priting into log


                write_log("CASEID : ".$row->ID); 
                write_log("START_TIME : ".$row->START_TIME); 

                 //how can i get third column which has xml data into php or html page?

I tried following ways starts from here

        // $xml_string =  .$row->EDITABLEL;
        //  write_log("ITAP: XML:  ".$xml_string);


        //var b=bool OCI-Lob::writeTemporary ( $xml_string [, int $lob_type = OCI_TEMP_CLOB ] );
        //write_log($b);
        // $file = "../wp-content/plugins/itap-functionality-plugins/sample.xml";
        // file_put_contents($file, $xml_string); 
        // var_dump($row->EDITABLE_INFO_SECTION);



        //echo "<pre>". htmlentities($xml_string) . "</pre>";


        //echo htmlentities($xml_string);

I tried following ways Ends here. And then I am printing that into HTML pAge

        $itap_html=" <table align=\"center\" style=\" width:70%; border:1px solid black; border-collapse: collapse; margin-left:15%;margin-top:10%; position:absolute;\" >
            <tr style=\"border:1px solid black;\">
            <th style=\"border:1px solid black;\">CASE ID</th>
            <th style=\"border:1px solid black;\">EDITABLE_INFO_SECTION</th> 
             </tr>
          <tr style=\"border:1px solid black;\">
            <td style=\"border:1px solid black; text-align: center;\">". $row->ID ."</td>
            <td style=\"border:1px solid black; text-align: center;\">". $row->EDITABLE."</td> 

          </tr>
        </table>";
    echo $itap_html;


    }

                return true;

}

1

There are 1 answers

0
Kiranaditya On

Got the answer... Need to add following lines After first block of code...

//reading Big Xml File 
        $foo = $row->EDITABLE_INFO_SECTION->load(); 
        write_log("This is xml output".$foo);