PDO Export Function - HTML Export export data into html directly using PDOModel helper functions

Description

PDOModel export to html functions allows to export data to html by passing array of data. Data needs to be passed in form of array and optionally you can define name of file to be exported.
Also, You can get data from select query and export data directly using this function.

Function Defination

  
                                void function arrayToHTML($htmlArray, $fileName = "file.html") ;
                                

Parameters Details

Details Type Example
$htmlArray - array of data array 2-D array of data
$fileName - optional name of file to be exported string any valid file name like "xyz.html"

Examples

  
                                $pdomodel = new PDOModel(); //create object of the PDOModel class
                                /* array to html function */
                                $data = array( array("row1col1","row1col2","row1col3","row1col4"),array("row2col1","row2col2","row2col3","row2col4"));
                                $pdomodel->arrayToHTML($data);
                                echo $pdomodel->outputHTML; // echo output html                              
                            

More Examples

 
                                //Example 1 
                                $records = $pdomodel->select("emp"); //get data from table
                                $pdomodel->arrayToHTML($records, "emp.html");//export it to html
                                echo $pdomodel->outputHTML; // read output html

                            

Result/Output

By default, it exports html file

Debug

Option Details Example
print_r($pdomodel->error) Print errors (if any)