由于页面重新加载,我需要停止重复数据..每次重新加载页面而不插入CSV ..我找不到重复
可能是什么问题?..代码工作正常
if(isset($_POST['submit']))
{
$file = $_FILES['file']['tmp_name'];
$handle = fopen($file,"r");
if (($handle = fopen($file, "r")) !== FALSE) {
while ($fileop = fgetcsv($handle,1000,",","'"))
{
$a = $fileop[0];
$b = $fileop[1];
$c = $fileop[2];
$d = $fileop[3];
$e = $fileop[4];
$f = $fileop[5];
$sql = mysql_query("INSERT INTO hzy3o_zhgooglemaps_markers (title, addresstext, published, baloon, icontype, mapid)
values('$a', '$b', '$c', '$d', '$e', '$f')");
}
}
}
if (isset($_POST) && count($_POST) > 0) {echo $form} else {header("Location: http://www.shambani.org /index.php?option=com_zhgooglemap&view=zhgooglemap&id=1&mapzoom=13&placemarklistid=&explacemarklistid=&grouplistid=&categorylistid=¢erplacemarkid=¢erplacemarkaction=&externalmarkerlink=0&mapwidth=&mapheight=&Itemid=177"); /* Redirect browser */
exit();}
?>
<form enctype="multipart/form-data" method="POST" action="" >
CSV<input type="file" name="file" />
<input type="submit" value="submit" name="submit"/>
</form>
答案 0 :(得分:0)
只需更改此行:
if (isset($_POST) && count($_POST) > 0) {
header("Location: http://www.shambani.org /index.php?option=com_zhgooglemap&view=zhgooglemap&id=1&mapzoom=13&placemarklistid=&explacemarklistid=&grouplistid=&categorylistid=¢erplacemarkid=¢erplacemarkaction=&externalmarkerlink=0&mapwidth=&mapheight=&Itemid=177"); /* Redirect browser */
exit();
} else {
echo $form
}