I have a MySQL database where I have a table with several columns.
One is name like 'Hèllo', for example.
The problem occurs when I access the results of this column. Example:
$query = mysql_query (" SELECT * FROM ........... ");
while($result = mysql_fetch_array($query)){
$myresult = $result["Hèllo"];
}
echo "$myresult";
This doesn't work because the name of the column contains the character 'è'. Are there any methods to solve this problem?
I tried:
mysql_query("SET NAMES 'utf8'");
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
By default mysql_fetch_array contains both "associative" and "number" indices, so if you know that this column on the third place just try to access it by index number:
$result[0],
$result[3],
etc.
HINT:
It is better to use PDO
Try to avoid such table/column names
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With