PDO Export Function - JSON Export export data into json directly using GOModel helper functions

Description

GOModel export to json functions allows to export data to json by passing array of data. Data needs to be passed in form of array.
Also, You can get data from select query and export data directly using this function.

Function Defination

  
                                void function arrayToJson($jsonArray) ;
                                

Parameters Details

Details Type Example
$jsonArray - array of data array 2-D array of data

Examples

  
                                $GOModel = new GOModel(); //create object of the GOModel class
                                /* array to json function */
                                $data = array( array("row1col1","row1col2","row1col3","row1col4"),array("row2col1","row2col2","row2col3","row2col4"));
                                $GOModel->arrayToJson($data);                         
                            

More Examples

 
                                //Example 1 
                                $records = $GOModel->select("emp"); //get data from table
                                $GOModel->arrayToJson($records);//export it to json

                            

Result/Output

By default, it exports json

Debug

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