Guys I'm using the code below to retrieve data from the database $lang_cat_table=mysql_query("select * from lang_cat_title where ID='$category_id'"); PHP: It is working fine for English, but not for Russian language. How can I fix this up.? I found this trick on php.net ,.but..to be frank I don't know how to implement this on my page. Could you help me implement this code with my query and also to set charset to utf8. if (!function_exists('mysql_set_charset')) { function mysql_set_charset($charset,$dbh) { return mysql_query("set names $charset",$dbh); } } PHP: Please let me know if you are using any other way to output Russian characters on page,I appreciate you help.Thanks
You must have initiated a connection with db before executing the query Just apply the function on it
this is the code you need: mysql_query("set names utf8"); $lang_cat_table=mysql_query("select * from lang_cat_title where ID='$category_id'");
That helped popol but the characters are appearing strange ( not question marks ) on internet explorer .Its perfectly fine on firefox
well, that's not a server side(PHP) issue anymore.. it's a browser issue.. try searching in google for russian fonts, install it on you machine, then test again..
Hi popol, when i rechecked my page on firefox the russian characters are appearing strange as it was appearing on IE before, I think its not the fault with browser too. I can see the russian characters on other pages and I'm wondering why it isn't proper only on my pages. BTW I even checked using "set character set utf8" . Even it didn't work
Its working fine now with <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> PHP: in header and mysql_query("set names 'utf8'"); before query. PHP: Thanks POPOL and forgive me for annoying you through PMing .
You are right but only once once after connecting to database. It is not required before every query.