php文件中插入数据库会出现两条记录

出现一个很奇怪的问题,在php中插入数据库,在一台电脑的火狐浏览器会出现两条记录,换浏览器或者换电脑都没有问题。后来把window.location.href的跳转方式改为header就没有问题了。

你的问题描述的不太清楚,没看明白

if($import_flag=="0"){ $date=date("ymd"); $dir=mb_substr($date , 0 , 4); $sql=mysql_query("select hotel_id from hotel_info",$conn); $i=1; while($info=mysql_fetch_array($sql)) { if($date==mb_substr($info['hotel_id'] , 0 , 6)) $i++; } $hotel_id=$date.sprintf("%03d", $i); if(!is_dir("../dbase/".$dir."/".$hotel_id)) { mkdir("../dbase/".$dir."/".$hotel_id,0777,true); chmod("../dbase/".$dir."/".$hotel_id, 0777); } mysql_query("insert into hotel_info(hotel_id,passwd,name,phone,usename,price_ver,apk_ver,pic_ver,osd_ver,video_ver,backmusic_ver,remark)values('".$hotel_id."','".$passwd."','".$hotel_name."','".$phone."','".$usename."',1,1,1,1,1,1,'".$remark."')",$conn); mysql_query("update guest_info set import_flag=1 where hotel_name='".$hotel_name."' and phone_number='".$phone."' and user_name='".$usename."' and user_pswd='".$passwd."'",$conn); } else{ mysql_close($conn); echo "alert('该酒店之前已导入,不能再次导入!');window.location.href='re.php';"; exit; } mysql_close($conn); //echo "alert('导入成功!');"; header("Location: re.php"); 这是代码,re.php这个页面在调用这个,当用window.location.href返回的时候就会出现两台记录,换成 header就好了

完全不知道你在说什么。。。