在hindi的mysql数据库中插入数据

时间:2013-10-02 13:57:48

标签: php jquery mysql sql

我已经完成了在hindi中的mysql中插入数据的代码。 我的代码正在脱机但不能在线工作.. 当我插入数据然后它在数据库中变成空白.. 我在我的代码中设置了utf-8 .. 在数据库中我设置了utf8 general_ci。

这是我的代码..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
</head>
<?php
include('connection.php');
?>
<?php
$ques=ucfirst($_REQUEST['question']);
$opta=ucfirst($_REQUEST['optiona']);
$optb=ucfirst($_REQUEST['optionb']);
$optc=ucfirst($_REQUEST['optionc']);
$optd=ucfirst($_REQUEST['optiond']);
$ans=ucfirst($_REQUEST['answer']);

?>

<body>
<div align="right"><a href="../main.php">Go Back To Logout</a></div>
<center><div style="background-image:url(images/background.jpg); width:1300px; height:680px;">

<form action="#" method="post">
<div style="width:700px; height:700px;">
<div>&nbsp;</div>

<div><font size="+3" style="color:#000099;"><strong>Insert Your Reasoning Question From Here :</strong></font></div>
<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>

   <?php
mysql_query("SET NAMES utf8");
if($_REQUEST['queinsert'])
{
$sql4="insert into reasoning values(NULL,'$ques','$opta','$optb','$optc','$optd','$ans')";
   mysql_query($sql4);
   echo "Question Successfully Inserted";
}

 ?>
   <div>&nbsp;</div>
<div style="width:400px;">Question : <input type="text" name="question" style="width:300px;" /></div>
<br />
<div style="width:400px;">Option a : <input type="text" name="optiona" style="width:300px;"  /></div>
<br />
<div style="width:400px;">option b : <input type="text" name="optionb" style="width:300px;"  /></div>
<br />
<div style="width:400px;">option c : <input type="text" name="optionc" style="width:300px;"  /></div>
<br />
<div style="width:400px;">option d : <input type="text" name="optiond" style="width:300px;"  /></div>
<br />
<div style="width:400px;">answer : <input type="text" name="answer" style="width:300px;"  /></div>
<br />
<div style="width:400px;"><input type="submit" value="Insert" name="queinsert" /></div>


</div>
</form>
</div></center>
</body>
</html>

0 个答案:

没有答案