Ich habe diesen PHP-Code ein mein Problem ist mit utf8 Zeichensatz. Wenn ich Daten von MySQL abrufen, funktioniert die UTF8 nicht. Irgendwelche Ideen über was falsch ist? Mysql Kollation ist utf8_general_ci. Aber mein PHP zeigt mir immer noch viele Fragezeichen (?) Anstelle von Griechisch. Im Folgenden habe ich 3 Screenshots meiner Suchergebnisse, meines SQL-Servers und meiner Datenbank. Jede Hilfe wäre großartig. Vielen Dank.PHP Utf8 Fehler
http://prntscr.com/cqj1ei http://prntscr.com/cqj25d
<?php
if(isset($_POST['search']))
{
$valueToSearch = $_POST['valueToSearch'];
$sql = "SELECT * FROM `works` WHERE CONCAT(`Onomateponumo`, `Odos`, `Arithmos`, `Perioxi`, `Hmerominia`, `Ora`, `Ergasia`, `Amoivi`, `Ypallilos`, `Tilefono`, `Alles_plirofories`) LIKE '%".$valueToSearch."%'";
$search_result = filterTable($sql);
}
else {
$sql = "SELECT * FROM `works`";
$search_result = filterTable($sql);
}
function filterTable($sql)
{
$connect = mysqli_connect("localhost", "root", "", "works1");
$filter_Result = mysqli_query($connect, $sql);
mysqli_set_charset($connect, "utf8");
return $filter_Result;
}
?>
<?php header('Content-Type: text/html; charset=utf-8');?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Προγραμμα Αναζητησης</title>
<style>
table,tr,th,td
{
border: 1px solid black;
}
</style>
</head>
<body>
<form action="fetch.php" method="post">
<input type="text" name="valueToSearch" placeholder="Value To Search"><br><br>
<input type="submit" name="search" value="Filter"><br><br>
<table>
<tr>
<th>Όνοματεπώνυμο</th>
<th>Διεύθυνση</th>
<th>Τηλέφωνο</th>
<th>Περιοχή</th>
<th>Ημερομηνία</th>
<th>Εργασία</th>
<th>Αμοιβή</th>
<th>Υπάλληλος</th>
<th>Τηλέφωνο</th>
<th>Πληροφορίες</th>
</tr>
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td><?php echo $row['Onomateponumo'];?></td>
<td><?php echo $row['Odos'];?></td>
<td><?php echo $row['Arithmos'];?></td>
<td><?php echo $row['Perioxi'];?></td>
<td><?php echo $row['Hmerominia'];?></td>
<td><?php echo $row['Ergasia'];?></td>
<td><?php echo $row['Amoivi'];?></td>
<td><?php echo $row['Ypallilos'];?></td>
<td><?php echo $row['Tilefono'];?></td>
<td><?php echo $row['Alles_plirofories'];?></td>
</tr>
<?php endwhile;?>
</table>
</form>
</body>
</html>
Try '
... und die Sortierung auf dem Tisch selbst ist? Besser noch - folgen Sie einfach diesen Schritten: http://stackoverflow.com/questions/279170/utf-8-all-the-way-through/279279 – CD001
Was ist mit Datenbank? Daten in Ordnung in DB? oder verfügbar in ??? – devpro