Lets see how to insert and retrive banlga font into the Mysql Database using PHP. We see the step for that.
First we Create a MySql database and tables which supports Bangla.
Insert Bangla value in the database .
Retrieve Bangla from the database.
To keep things simple and easy to understand open the mysql command
prompt.
- mysql> set names ‘utf8′;
- mysql> create database bangla character set utf8 collate utf8_general_ci;
- mysql> use bangla;
- mysql> create table profile (profile_name varchar(100) character set utf8 collate utf8_general_ci);
Insert Bangla :
So we create a database. Now we insert the value into the database. Insert Bangla Value in the database :
We create a simple form :
Input Form
Then we will insert into the database :
We create a coonection .
1. $c = mysql_connect(“localhost”,”root”,””);
2. mysql_select_db(‘bangla’) or die (mysql_error());
//******These two line are used for Bangla Character *********/
3. mysql_query(‘SET CHARACTER SET utf8’);
4. mysql_query(“SET SESSION collation_connection =’utf8_general_ci'”) or die (mysql_error());
//***************************************************/
You must add these two lines just after selecting the database, i.e mysql_select_db() function.
mysql_query(’SET CHARACTER SET utf8′);
mysql_query(”SET SESSION collation_connection =’utf8_general_ci’”);
If you want to see more details then look at here (http://hasin.wordpress.com/2006/07/18/storing-bangla-unicode-text-in-mysql-database/)
Now we will insert :
if(isset($_POST))
{
mysql_query(“insert into profile values($_POST[“username])) or die (mysql_error());
echo ‘saved into database’;
}
else
{
echo ‘Not posted’;
}
Now we check how the font stores into the database .
Retrieve Bangla from the database:
The display is as simple as retrieve other database.
$res = mysql_query(“select * from profile”,$c);
echo “ Display resrult from database “;
echo “————————“;
while($row = mysql_fetch_array($res))
{
echo $row[‘profile_name’] .’
‘;
}
echo “————————“;
Now one of the thing is how you write bangla in the webpage
I fyou have no font please download the free software
Avro software
http://www.omicronlab.com/avro-keyboard-download.html
Dear God-Thanks for Giving me yesterday