分批次从musql取数据,每次取1000条

$t = new Gettags();

$num=$t->sum_tag();
$num=$num/1000;
$flag_num=ceil($num); $flag_array=array(); $f=0; for ($i=1; $i<=$flag_num; $i++) { $tag_name=$t->get_tag($flag);
foreach($tag_name as $k=>$v){
$flag_array[$f]=$v;
++$f;
} } //查询标签库所有标签 public function get_tag($n){ $n=$n*1000;
$m=$n+999;
$sql="select tag_name,tag_id from xcar_tag where status >0 limit $n,$m";
$res = $this->tdb->query($sql);
$result = $this->tdb->fetch_array($res); return $result;
} //计算标签库
public function sum_tag(){ $sql="select count(tag_id) as count from xcar_tag where status >0"; $query = $this->tdb->query($sql);
$result = mysql_fetch_array($query); return $result['count']; }
上一篇:cmp比较指令对标志寄存器的影响


下一篇:percona-toolkit安装