Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert Bangla language to Mysql database

Tags:

php

mysql

I'm creating dynamic website with Php and Mysql. So i need insert bangla language to Mysql database. How do i do this with php and mysql ?

Insert code:

$query = mysql_query("INSERT INTO news_post VALUES ('', '', '$subject', 
'$img','$image_named_uniq','$message','$news_id','$cat_name','', '$poster', '$date' )");

Well, if i write English Language then its OK, But if i write Bangla Language then it's show Something like that == &#2477 া&#248 ;&#24 4;&#2480 ; ম& #2494; == Like Html entities...

Or any Idea that will better for me.
Shibbir.


1 Answers

You must add these two lines just after selecting the database, i.e mysqli_connect() function.

mysqli_query($conn,'SET CHARACTER SET utf8'); mysqli_query($conn,"SET SESSION collation_connection ='utf8_general_ci'");

like image 131
Ariful Islam Avatar answered Mar 31 '26 10:03

Ariful Islam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!