sp转移数据法,把A,B表的数据转到C表中

#1 xpp1000

class main extends spController
{
function index(){
  
  $sp=spClass("dede_archives");
  $sql="select a.body ,b.title ,b.keywords,b.description   from dede_addonarticle a,dede_archives b where a.aid = b.id limit 10500,1500 ";
  $tpl=$sp->findSql($sql);
  $asd=array();
  foreach($tpl as $rs)
  {$body=$rs["body"];
  $title=$rs["title"];
  $keywords=$rs["keywords"];
  $description=$rs["description"];
  
  
  $asd[]=array('catid'=>'1', 'title'=>$title,'content'=>$body,'keywords'=>$keywords,'description'=>$description,'hits'=>'2','userid'=>'1','username'=>'guaishi','userip'=>'127.0.0.1','addtime'=>'1306050980','updatetime'=>'1306050980','checker'=>'guaishi','checktime'=>'1306050980','passed'=>'1','ontop'=>'1','elite'=>'1','recycle'=>'0','adflag'=>'0','uncmt'=>'0','author'=>'未知','copyfromname'=>'本站原创' );
  }
  dump($asd);
  $spd=spClass("jx_article");
  $tp=$spd->createAll($asd);
  if($tp)
  {echo '成功添加100条数据';
  exit();
  }
}
}

2011-06-19 18:06:49

#2 jake

嗯,建议加上set_time_limit(0);让程序不至于超时。

2011-06-19 21:15:57