Ranjit
Ranjit

Reputation: 1724

Create a .sql file in php

I have used the bellow code for get the wp-option value.

function option_value_change () {
  global $wpdb;
  $myrows = $wpdb->get_results( "SELECT *
  FROM `wp_options`");
    foreach ($myrows as $rows){
      $option = get_option($rows->option_name);
            $optin_id = $rows->option_id;
            $option_name = $rows->option_name;
            $option_value = $row->option_value;
            $option_load = $row->option_autoload;
            echo $option_value;
    }
}

now i want to create a .sql file using those above values. How can i create a .sql file using those values.

Upvotes: 2

Views: 10449

Answers (1)

Blackgrid
Blackgrid

Reputation: 810

You have to generate the create table and insert statements manually. There is a good article here that has a backup script written in PHP.

http://davidwalsh.name/backup-mysql-database-php

Upvotes: 4

Related Questions