When i return a row from my mySQL database, I get a ? instead of some characters eg:ò, à etc. My mysql row and table are set to utf8_unicode_ci, so I think the database is storing it correctly but php isnt returning it correctly.
Think it has something to do with mysql_set_charset
but cant get it to work properly. Any help would be greatly appreciated!!
<?php
if($row = mysql_fetch_assoc(queryDb("SELECT * FROM customer WHERE uuid='".$_COOKIE['uuid']."'")))
{
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$gender = $row['gender'];
$ileach_first_name = $row['ileach_first'];
$ileach_last_name = $row['ileach_last'];
}
//If Ileach Name is blank
if($ileach_last_name == "" || $ileach_first_name == ""){
// Get ileach last name
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_last_names WHERE eng_name='$last_name'"));
$ileach_last_name = $row['gae_name'];
if($ileach_last_name == "") {
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_last_names order by rand() limit 1"));
$ileach_last_name = $row['gae_name'];}
//Get ileach First Name
//If Male
if($gender == 'M') {
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_first_names_m WHERE eng_name='$first_name'"));
$ileach_first_name = $row['gae_name'];
//If no name is selected, get one randomly
if($ileach_first_name == "") {
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_first_names_m order by rand() limit 1"));
$ileach_first_name = $row['gae_name']; }
}
//If Female
else{
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_first_names_f WHERE eng_name='$first_name'"));
$ileach_first_name = $row['gae_name'];
//If no name is selected, get one randomly
if($ileach_first_name == "") {
$row = mysql_fetch_assoc(queryDb("SELECT * FROM ileach_first_names_f order by rand() limit 1"));
$ileach_first_name = $row['gae_name'];}
}
//Save ileach name into db
mysql_query("UPDATE customer SET ileach_first = '$ileach_first_name'
WHERE uuid='".$_COOKIE['uuid']."' ");
mysql_query("UPDATE customer SET ileach_last = '$ileach_last_name'
WHERE uuid='".$_COOKIE['uuid']."' ");
}
//Stitch name together.
$full_ileach_name .=$ileach_first_name;
$full_ileach_name .= " ";
$full_ileach_name .= $ileach_last_name;
?>