Search and replace text on an entire mysql database

    Rating: ★★★★☆
    View: 288
    Download: 176
    Từ khóa:

    Some benefit that you use this class for:

    - Replace all text in database

    - Search and replace on many tables

    - input filter very strick

    - If you need you can expand this php class to use for any database in future

    The usage is very simple:

    
    // Create an instace of the class
    $mysqlSearchAndReplace = new mysqlSearchAndReplace("myDatabase", "localhost", "root", "");
    
    // Simple search and replace
    $mysqlSearchAndReplace->searchAndReplace("old text", "new text to replace");
    
    // Case sensitive = true
    $mysqlSearchAndReplace->searchAndReplace("Old Text", "
    new text to replace
    ", true);
    
    // We specify the tables where search
    $mysqlSearchAndReplace->searchAndReplace("old text", "
    new text to replace
    ", true, array('tableOne', 'tableTwo'));

    Create Database for test 

    CREATE TABLE IF NOT EXISTS `mytable` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `question_id` int(11) NOT NULL,
      `answer` varchar(255) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    HTML Form markup

    *Please fill all the texts in the fields.

     

    loading Đang tải...

    template được ưa chuộng