search
Homephp教程php手册php实现refresh刷新页面批量导入数据的方法,refresh刷新页面

php实现refresh刷新页面批量导入数据的方法,refresh刷新页面

本文实例讲述了php实现refresh刷新页面批量导入数据的方法。分享给大家供大家参考。具体分析如下:

这个功能是参考dedecms生成html页面的原理,只是dedecms使用的是js跳转而我使用的是refresh进行跳转,效果是一样的,下面我们一起来看一个php实现批量导入数据的方法.

因为我有1000W数据一次导入数据库肯定是不可行了,所以我就导致了每一次导入50条或更多数据,然后下次再刷新一次这样就可以解决这个问题了,代码如下:

复制代码 代码如下:

set_time_limit(0); 
//连接数据库
 
$s = isset( $_GET['s'] )?$_GET['s']:0;
$e = isset( $_GET['e'])?$_GET['e']:50;
$count =85000;
 
if( $s {
 $sql = "select * from bac_info where isget =0 order by id desc limit $s,$e ";
 $query = mysql_query( $sql );
 while( $rs = mysql_fetch_array( $query ) )
 {
  $id = $rs['id'];
  $sms = $rs['sms'];
  $typeid = $rs['typeid'];
  $isget = $rs['isget'];
  $sql = "insert into bac_info_bak (id,sms,typeid,isget) values('$id','$sms','$typeid','$isget')";
  mysql_query( $sql ) ;
  echo $sql;
  //exit;
  $sqlu = "update bac_info set isget=1 where id =".$rs['id'];
  mysql_query( $sqlu );
 }
 echo '正在处理数据,当前为'.$s.'条......';
}
else
{
 echo '完成所有数据处理 再随机排序一次';
}
?>

希望本文所述对大家的php程序设计有所帮助。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.