Forum Moderators: coopster

Message Too Old, No Replies

problem with Greek character

         

Shanee

6:03 pm on Nov 4, 2008 (gmt 0)

10+ Year Member



Hello to all...
i am a newbie to php + mysql. i have problem while fetching Greek characters from mysql table with the help of php while loop. the result comes in (?) sign of interrogation. but when i try to export same table from mysql with help of phpmyadmin. it give me the right result. here is my code. and mysql schema.

Mysql Table
CREATE TABLE IF NOT EXISTS `news_category` (
`catid` varchar(11) NOT NULL,
`category` text character set greek NOT NULL,
PRIMARY KEY (`catid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `news_category`
--

INSERT INTO `news_category` (`catid`, `category`) VALUES
('1', 'ΕΙΔΗΣΕΙΣ'),
('2', 'ΟΙΚΟΝΟΜΙΑ');

PHP CODE
<?php

$sql = "select * from news_category order by catid";
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("%s <br>", $myrow["category"]);

} while ($myrow = mysql_fetch_array($result));

}

?>

the problem is, when i want to display the category title. it display just (?) signs.

i will be so thanksfull if someone can help me in this matter

jatar_k

6:29 pm on Nov 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if the data si correct, as phpmyadmin would suggest, then maybe it is as simple as the charset used by the html page

<meta http-equiv="Content-Type" content="text/html; charset="iso-8859-1" />

I think that's right for latin1

Shanee

6:50 pm on Nov 4, 2008 (gmt 0)

10+ Year Member



i have already changed the heading.

jatar_k

6:56 pm on Nov 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe try utf-8 then and see what that does

since phpmyadmin shows it properly then you are inserting it correctly, this makes it, more than likely, just a display issue.