alejandro52 Posted May 23, 2007 Share Posted May 23, 2007 I created a databae that i added greek text in it and when i try to get the data to echo in a table i get ????.Any help? I also set the collation of the table and the field to greek_general Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/ Share on other sites More sharing options...
kathas Posted May 23, 2007 Share Posted May 23, 2007 try setting it to utf8_* (like utf8_unicode_ci) and it might solve your problems... it may be HTML problem (i don't think though) so before you do that try setting: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259704 Share on other sites More sharing options...
dsaba Posted May 23, 2007 Share Posted May 23, 2007 read this thread: http://www.phpfreaks.com/forums/index.php/topic,134575.msg594890.html#msg594890 you need to set collation to utf8_bin in mysql and also do a number of other things like set the connection in that charset as well Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259706 Share on other sites More sharing options...
alejandro52 Posted May 23, 2007 Author Share Posted May 23, 2007 I tried both of them but nothing changed. I put utf8_unicode in both the table and the field. Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259709 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 might be a stupid question... but do you have the greek language file installed into your computer? Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259710 Share on other sites More sharing options...
alejandro52 Posted May 23, 2007 Author Share Posted May 23, 2007 might not be a stupid one... .You mean the windows or i need an sql file to install for gree language support?I have the wamp pack. Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259719 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 the windows one... Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259721 Share on other sites More sharing options...
dsaba Posted May 23, 2007 Share Posted May 23, 2007 if you followed my instructions in my other post, the other thread you need nothing extra, sql comes built in for greek support (utf-8 support) if you are using windows, you need to have greek fonts added, go to regional settings, make sure greek is selected as an installed language but i suspect it is not because of that, did you set the connection for mysql to utf-8 ??? and did you save you php file in utf-8, there were a bunch of steps in my thread that I linked did you follow it??? Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259722 Share on other sites More sharing options...
alejandro52 Posted May 23, 2007 Author Share Posted May 23, 2007 hehe, yeah i got the windows greek language installed. And i just noticed the post with the link.Ill go check it out. Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259724 Share on other sites More sharing options...
alejandro52 Posted May 23, 2007 Author Share Posted May 23, 2007 I tried all the steps but nothing happened. Except this one 2. the connection to your database must be in that charset with the SET NAMES code. When i connect to the database i have $query = 'SELECT * FROM erotiseis ORDER BY id DESC'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); how should i change it to do the step you said Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259732 Share on other sites More sharing options...
dsaba Posted May 23, 2007 Share Posted May 23, 2007 it is like this: $connect = mysql_connect("address", "name", "password") or die ("Hey loser, check your server connection."); mysql_select_db("mysql_name", $connect); $sql = "SET NAMES utf8 COLLATE utf8_bin"; mysql_query($sql) or die(mysql_error()); $query = 'SELECT * FROM erotiseis ORDER BY id DESC'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); once you SET NAMES, basically this means this connection now sends data to and from mysql in utf-8 charset, you can run as many queries as you want after that, you only have to SET NAMES once after you connect to the database Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259751 Share on other sites More sharing options...
alejandro52 Posted May 23, 2007 Author Share Posted May 23, 2007 Indeed.That did the Job. Thx for the help. Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-259961 Share on other sites More sharing options...
dsaba Posted May 24, 2007 Share Posted May 24, 2007 glad you solved it I had a mess of problems before that led me to enlightenment on such subjects of language universal support So I try to spread the knowledge -mark Topic Solved if the topic is solved also Quote Link to comment https://forums.phpfreaks.com/topic/52630-greek-shows-as-when-getting-data-from-database/#findComment-260429 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.