Posts

Showing posts with the label database-zip

How to backup wordpress database without phpmyadmin using php code

Just copy below code and run this code to take a backup of your website . <?php require 'wp-load.php'; global $wpdb;         $tables = $wpdb->get_results( 'SHOW TABLES', ARRAY_N );         $return = '';         foreach ( $tables as $table ) {             $num_fields = sizeof( $wpdb->get_results( 'DESCRIBE `' . $table[0] . '`;' ) );             $return .= 'DROP TABLE IF EXISTS `' . $table[0] . '`;';             $row2 = $wpdb->get_row( 'SHOW CREATE TABLE `' . $table[0] . '`;', ARRAY_N );             $return .= PHP_EOL . PHP_EOL . $row2[1] . ";" . PHP_EOL . PHP_EOL;                             $result ...