I have a simple sql query, in a joomla php server, rs forms pro. The result contains Greek characters. However, the result is displayed in question marks.
$sql = "SELECT `FieldValue` FROM `table` where `FieldName` = 'age' and `SubmissionId` = ".$submissionId."
";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc())
{ echo
$row["FieldValue"] ;
}
Result:
??? 20 ???? (question marks should be Greek letters)
I tried using convert as utf8, and it did not work. Likewise with
header('Content-type: text/plain; charset=utf-8');
header('Content-Type: charset=utf-8');
mysqli_set_charset($con, 'utf8mb4');
They did not work either. What else can i do?
$sql = "SELECT CONVERT(`FieldValue` USING utf8) as `FieldValue`
FROM `table` where `FieldName` = 'age' and `SubmissionId` = ".$submissionId."";
mysql_ and
mysqli_` functions. Don't mix them in your script.