Reputation: 17
I am having an error with some Mysql Characters.
<?php
$con = mysql_connect("localhost", "root", "");
if(!$con){
die(mysql_error());
echo "Não foi possivel ligar-se à base de dados";
}
$select_db = mysql_select_db("desempenho", $con);
if(!$select_db){
die(mysql_error());
echo "Não foi possivel selecionar a base de dados";
}
mysql_query("SET NAMES 'utf8'");
?>
And now here is another page where this is included:
include "../includes/connect.php";
session_start();
$nome = $_SESSION['nome'];
and it goes on.
The $nome variable is passed throught session and gotten from the login. I get an error printing this variable when it has a name like "João" because of the "ã". (this variable stores the username gotten on the login)
I also have the html tag to recognize UTF-8 Characters
<meta http-equiv='Content-type' value='text/html; charset=UTF-8' />
this is the error: HTML contains invalid UTF-8 character(s)
Thanks in advance
Upvotes: 0
Views: 78
Reputation: 157828
I also have the html tag to recognize UTF-8 Caracters
this HTML tag is totally useless. It's HTTP Header sets encoding, not HTML tag.
header('Content-Type: text/html; charset=utf-8');
Upvotes: 1