PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of chema garrido   My Utils   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example usage
Class: My Utils
Export and optimize MySQL database tables
Author: By
Last change: public
Date: 12 years ago
Size: 1,038 bytes
 

Contents

Class file image Download
<?php
   
//makes it compatible with php 5.2.x
   
if ( !defined('__DIR__') ) define('__DIR__', dirname(__FILE__));
   
   
//php ini
   
error_reporting(E_ALL | E_STRICT);
   
ini_set('display_errors','on');
   
ignore_user_abort(TRUE);
   
set_time_limit(0);
   
ini_set('memory_limit', '1024M');
   
   
   
    include
'my_utils.php';
   
   
$mu = new my_utils('root','','localhost','oc');
   
   
/**
     * Export schemas into multiple files
     */
   
$mu->export();//only schema default, all the tables
   
$mu->export(__DIR__.'/export/',array('oc_accounts','oc_categories'),TRUE,TRUE);
   
   
/**
     * Optimize tables
     */
   
$mu->optimize_tables(array('oc_posts','oc_locations'));
   
$mu->optimize_tables();//all the tables
   
    /**
     * changes DB
     */
   
$mu->set_dbname('ocaku');
   
   
/**
     * shows all the tables from a db
     */
   
var_dump($mu->show_tables());
   
   
/**
     * returns the create for a single table
     */
   
echo $mu->show_create_table('pages');//1 table
   
echo $mu->show_create_table('pages',TRUE);//1 table with the data