Reputation: 167
hello i am using MYSQL for my data base. When i use Mongolian font. it saves in MYSQL like ????. How to correct this?
When i save in English it looks ok but in Mongolian it looks like ??? in the picture. In the screen it also looks like ????
my MYSQL insert code is:
$sql ="INSERT INTO core_network (system_name,sub_cat,location,alarmtype,severity,start_time,end_time,reason,shift_operation)
VALUES ('$S_name','$subcategory','$city','$a_type','$severity','$S_time','$F_time','$reason','$shift_operation')";
how to correct?
Upvotes: 2
Views: 3181
Reputation: 33678
You need to set the collation of the columns to an UTF-8 one like utf8_general_ci
.
Also you have to make sure that the connection charset is UTF-8 as well, for example by issuing
SET NAMES "utf8"
before any other SQL.
Upvotes: 2
Reputation: 1324
$connection = mysql_connect($host1, $user, $pass)
or die("Could not connect: ".mysql_error());
mysql_select_db($database1,$connection)
or die("Error in selecting the database:".mysql_error());
after connect to DB and before use "SELECT" use this code :
mysql_query("SET CHARACTER SET utf8",$connection);
Upvotes: 3