mysql connection related to EUR € symbol using PHP
"€" can not be recognized by ISO-8859-1 standard as it is encoded by UTF-8.
By default, mysql connection using ISO-8859-1 based connection, and will turn "€" as "â" using mysql query. In order to get a correct "€", then mysql connection should be like this:
$conn = mysql_connect($host.':'.$port, $username, $password);
mysql_set_charset("utf8");
$query = "select ...";
$db= mysql_select_db($database, $conn);
$result = mysql_query($query);
By default, mysql connection using ISO-8859-1 based connection, and will turn "€" as "â" using mysql query. In order to get a correct "€", then mysql connection should be like this:
$conn = mysql_connect($host.':'.$port, $username, $password);
mysql_set_charset("utf8");
$query = "select ...";
$db= mysql_select_db($database, $conn);
$result = mysql_query($query);
Comments
Post a Comment