using russian in msql & display it via php
Posted by: Paul Godard
Date: July 23, 2009 03:39AM

Hi
I am totally new to collation/charset. I have a database with English & German content, that need to also include Russian. My original table was built with the default values : charset=latin1 & collation=latin1_swedish_ci; I have added a field to hold the russian translation with collation=koi8r_general_ci. In phpMyAdmin, I have copy paste the Russian string in Product_russian and it works fine when I view the content in phpMyAdmin.

CREATE TABLE Products (
`Product_ID` int( 9 ) NOT NULL auto_increment ,
`Product_english` varchar( 240 ) NOT NULL default '',
`Product_german` varchar( 240 ) NOT NULL default '',
`Product_russian` varchar( 240 ) character set koi8r NOT NULL ,
PRIMARY KEY ( `Product_ID` ) ) ENGINE = MyISAM DEFAULT CHARSET = latin1;

My problem is to display the content of the russian field in html via php/mysql.

Here is the script (simplified), but it only displays '?????', although the mysql table contains the correct characters.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=KOI8-R;" />
</head>
<body>
<?php
$sql = mysql_query("SELECT Product7 FROM `PW_xProduct` WHERE Product_ID = 1")
$Row = mysql_fetch_array($sql);
$Russian = $Row[0];
echo "Russian Text displayed from database : ".$Russian;
?>
</body>

What should I do to display the correct russian characters?

Options: ReplyQuote


Subject
Views
Written By
Posted
using russian in msql & display it via php
5040
July 23, 2009 03:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.