CodeIgniter Forums
Export DB to sql file - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Export DB to sql file (/thread-41742.html)

Export DB to sql file - El Forum - 05-16-2011

This is a library class to export structure as well as data from tables also export complete db in sql file.

The implementation is very simple. Example implementation is below:

// Load Export sql library
//  Add where clause
        $where = array(
            'id' => 123,

        //  Create list of tables to be exported.
        //  Mark whether to dump data as true/false
        //  By default its false.
        $tables = array(
            'table1'        => TRUE,
            'table2'     => TRUE,

        $this->export_sql->export($tables, $where, FALSE); // If true is provided for the last argument, it will export full DB.

Place the attached library file in you application libraries directory


Feel free to let me know your comments.

Export DB to sql file - El Forum - 05-16-2011

take a look at the CI database utilities class:

it also provides backup functionality and some other handy tools too.