Friday, November 25, 2011

♫ ADD BANGLA INFO. IN DB:

when creating database , select the charset to utf8 and collation to utf8_general_ci
now write the following code and save it as banglainsert.php:



<form method="post">
<input type="text" name="profile_name" id="profile_name">
<input type="text" name="profile_name2" id="profile_name2">
<input type="submit" name="submit" id="submit" value="submit">

</form>

<?php

$db=mysql_connect("localhost","root","")or die("error in db connection....");

$dbselect=mysql_select_db("bangla2",$db)or die("error in db selection......");

mysql_query('SET CHARACTER SET utf8');

mysql_query("SET SESSION collation_connection ='utf8_general_ci' ");

if (isset($_POST['submit']))

{

$profile_name=$_POST['profile_name'];

$profile_name2=$_POST['profile_name2'];

$query="insert into profile (bangla,english)

values('$profile_name','$profile_name2')";

if(!$result=mysql_query($query))

echo "error";

else

echo "success";

}

else

echo mysql_error();

?>

No comments:

Post a Comment