Jump to content

Greek shows as ??? when getting data from database


alejandro52

Recommended Posts

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???

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.