Change URL of all Mysql DBMS tables with PHP

Asked

Viewed 111 times

-1

  • Maybe I can help you: https://answall.com/q/29508/89055

  • This would be a slow process, because there are more than 30 tables in the bank. Thanks for the contribution.

1 answer

1


You can use the information_schema.Columns table to extract the list of columns and tables and assemble the update instructions to run individually. Example:

SELECT
    CONCAT('UPDATE ', table_name, ' SET ', column_name, ' = REPLACE(', column_name, ', ''xxx'', ''yyy'');')
FROM
    information_schema.columns
WHERE
    table_schema = '<SEU BANCO AQUI>'
    AND data_type IN ('char, ''varchar', 'text')
ORDER BY
    table_name,
    ordinal_position;
  • I tried this and could not, it is news to me, I changed url1 and url2 and the name of the database, I tried in phpmyadmin to execute the command, gave a total of 18 results, but did not change, in DB has the information_schema, but I do not know how to make use of execute and assemble the instructions.

  • It worked, opaaaa, I saw that you need to print the return view, returned several SQL commands and ran them and was successful, Thank you very much.

  • Great! Luck and success for you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.