In my earlier post php-mysql connection charset fix, I mentioned I was having issues with enforcing an UTF8 charset. I found the solution:
@$conn = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
// or die(mysql_error());
if (!$conn||mysqli_connect_errno())
{
throw new Exception('Could not connect to database server:'.
mysqli_connect_error());
}
else
{
$conn->query( "SET NAMES 'utf8'" );
$conn->set_charset("utf8");
return $conn;
}










One Trackback
[…] and then each table and finally each column, the connection still defaults to latin-1. I provide the solution in a later post and below for your Google searching convenience. @$conn = new mysqli(DB_SERVER, […]