Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $DB_HOST = 'localhost'; // The host or domain to your MySQL database
- $DB_NAME = 'my_database'; // The database containing the Tables you wish to change.
- $DB_USER = 'root'; // The Username that has privilages or access to the database
- $DB_PASS = 'password'; // The password associated with the username
- $db = mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die('Couldn\'t Connect to MySQL. Please recheck the Host, Username and Password');
- mysql_select_db($DB_NAME) or die('Couldn\'t Connect to the Database. Please double check the name of the database for typos. As well as ensure that the Username has privilages on the database');
- $r = mysql_query('SHOW TABLES');
- while($t= mysql_fetch_array($r)){
- foreach($t as $k => $v) {
- mysql_query("ALTER TABLE $value COLLATE latin1_swedish_ci") or die('MySQL Query Error: ' . mysql_error());
- }
- }
- echo 'All Tables in database, have successfully been altered.';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement