PHP changing table collation (encoding) from latin_swedish (or any other) to UTF-8

<?php

$server = “localhost”;
$user=”user_details”;
$pw=”password”;
$db=”111111_database”;

mysql_connect(“$server”,”$user”,”$pw”) or die (“could not connect to mysql”);
mysql_select_db($db) or die (“could not find Database”);
mysql_query(“SET CHARACTER SET ‘utf8′”);
mysql_query(“SET NAMES ‘utf8′”);
mysql_query(“ALTER TABLE optimet_leads CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;;”);

?>

Leave a Reply

Your email address will not be published. Required fields are marked *