I have a MySQL database on my hosting company. When i view data in MySQL Query Browser etc. there is no problem. But i can't view data that has Turkish Letters correctly in my site.
My Database and Tables encoded as Latin5 (ISO-8859-9)
These are my database variables:
character_set_client = utf8
character_set_connection = lutf8
character_set_database = latin5
character_set_results = utf8
character_set_server = latin1
character_set_system = utf8
collation_connection = utf_general_ci
collation_database = latin5_turkish_ci
collation_server = latin1_swedish_ci
As i read in heres
( http://www.mambers.com/showthread.php?t=27330 )
( http://www.codingforums.com/showthread.php?t=50218 )
I'm tring a code as below but no way:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9"><title>150. Dönem Listesi</title><style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
-->
</style>
</head>
<body>
<?php
// set server access variables
$host = "example.com";
$user = "ali";
$pass = "veli";
$db = "veritabani";
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Veritabaný seçilemiyor!");
$query1 = "SET NAMES 'latin5'";
$query2 = "SET CHARACTER SET latin5";
$query3 = "SET COLLATION_CONNECTION = 'latin5_turkish_ci'";
// create query
$query = "SELECT * FROM TABLO1";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
// see if any rows were returned
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<table cellpadding=1 border=1>";
while($row = mysql_fetch_object($result)) {
echo "<tr>";
echo "<td>".$row->AD."</td>";
echo "<td>".$row->SOYAD."</td>";
echo "</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "Herhangi bir kayýt yok!";
}
// free result set memory
mysql_free_result($result);
// close connection
mysql_close($connection);
?>
<p>ÝÞÐÇÜÖ</p>
</body>
</html>
What am i doing wrong? I'm looking for answer about 2 days. Please.