数据在MySql中插入两次? [英] Data Inserting twice in MySql ?

查看:128
本文介绍了数据在MySql中插入两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在mysql数据库中插入数据时,数据插入两次。



这是我的代码



While inserting data in mysql database, data is inserting twice.

Here is my code

<?PHP
	session_start();
	require("connection.php");
	
	//print_r($_POST);
	
	$ques = $_POST['typeahead'];
	$file_name = '';
	$file_location = '';
	$mess_detail = $_POST['message'];
	
	
	
	$sqlInsert = "insert into querry (user, querry, file_name, file_location, message, date_added) values ('mayank', '".$ques."', '', '', '".$mess_detail."', NOW())";
		
	if(mysql_query($sqlInsert, $conn))
	{
		echo "Successfully Updated....";		
	}
	else
	{
		echo "Failed....";
	}
?>





这里是我的表结构:





Here Is my table structure:

CREATE TABLE IF NOT EXISTS `querry` (
  `querry_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of Querry',
  `user` varchar(20) NOT NULL COMMENT 'user who asked the querry',
  `querry` varchar(255) NOT NULL,
  `file_name` varchar(30) DEFAULT NULL,
  `file_location` varchar(250) DEFAULT NULL,
  `message` varchar(10000) DEFAULT NULL,
  `date_added` datetime NOT NULL,
  PRIMARY KEY (`querry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;





我去了但没有运气......



I googled but no luck......

推荐答案

_POST);

_POST);


ques =
ques =


_POST [' 预输入'];
_POST['typeahead'];


这篇关于数据在MySql中插入两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆