Advertisement
Guest User

Untitled

a guest
Sep 19th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. $database_name='';
  4. $database_username='';
  5. $database_password='';
  6.  
  7. $connection = mysqli_connect('localhost',$database_username,$database_password);
  8.  
  9. if(!$connection) {
  10. echo "Cannot connect to the database – incorrect details";
  11. } else{
  12. mysqli_select_db($connection, $database_name);
  13. $result=mysqli_query($connection, 'show tables');
  14.  
  15. while($tables = mysqli_fetch_array($result)) {
  16.  
  17. foreach ($tables as $key => $value) {
  18. //echo "ALTER TABLE ".$value." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci<br>";
  19. mysqli_query( $connection, "ALTER TABLE ".$value." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
  20. }
  21. }
  22. echo "Successfull collation change!";
  23. }
  24.  
  25. mysqli_close($connection);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement