I got the next problem.
I send a filtered request to the database (MySQL) to get a remark, which the column is a utf8_general_ci collection type.
I use and echo to see what's the data that I get and this contains strange characteres. However they are correct in the database, but when I request for them I got this.
Resultado: ESTÃN CONSTRUYENDO UNA CAFETRIA EN LA ESCUELA. Resultado: TODAVÃA NO FUNCIONA LA CAFETERIA, POR LO QUE NO HAY VARIACIÃN.
Which should be, in fact it's saved like that into the DB:
Resultado: ESTÁN CONSTRUYENDO UNA CAFETRIA EN LA ESCUELA. Resultado: TODAVÍA NO FUNCIONA LA CAFETERIA, POR LO QUE NO HAY VARIACIÓN.
This is the function:
Code: Select all
function cObservacion($prim_key, $fieldname) {
try {
$conn = conectar();
$query = "SELECT remark FROM mmic_data WHERE prim_key='" . $prim_key . "' AND fieldname='" . $fieldname . "'";
//echo 'Query answertext: ' . $query . '<br />';
$result = mysql_query($query, $conn);
if (mysql_num_rows($result) != 0) {
$observacion = utf8_encode(mysql_result($result, 0));
echo ' Resultado: ' . utf8_encode($observacion);
return $observacion;
}
/*
Regresar valor vacio, esto significa que esa pregunta no fue llenada en el cuestionario.
Esto es ocasionado por las preguntas filtro que excluyen algún periodo para la siguiente pregunta.
*/
else {
return '';
}
}
catch (Exception $e) {
echo '<br />Error: ', $e->getMessage();
mysql_close($conn);
}
}I just add the utf8_encode function and it doesn't work anyway.
What du you think guys?