Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Connect to your MySQL database.
- $hostname = "localhost";
- $username = "db_username";
- $password = "db_password";
- $database = "db_name";
- mysql_connect($hostname, $username, $password);
- // The find and replace strings.
- $find = "find_this_text";
- $replace = "replace_with_this_text";
- $loop = mysql_query("
- SELECT
- concat('UPDATE ',table_schema,'.',table_name, ' SET ',column_name, '=replace(',column_name,', ''{$find}'', ''{$replace}'');') AS s
- FROM
- information_schema.columns
- WHERE
- table_schema = '{$database}'")
- or die ('Cant loop through dbfields: ' . mysql_error());
- while ($query = mysql_fetch_assoc($loop))
- {
- mysql_query($query['s']);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement