db); Zend_Db_Table::setDefaultAdapter($db); $sql="select item_id,title from knl_article"; $rs=$db->fetchAll($sql); foreach($rs as $r) { $sql="select item_id,place,keyword from knl_keyword where item_id=?"; $rs1=$db->fetchAll($sql,array($r['item_id'])); foreach($rs1 as $r1) { $sql="update knl_article set keywords[?]=? where item_id=?"; $db->query($sql,array($r1['place'],$r1['keyword'],$r1['item_id'])); } $sql="select item_id,place,author from knl_author where item_id=?"; $rs1=$db->fetchAll($sql,array($r['item_id'])); foreach($rs1 as $r1) { $sql="update knl_article set authors[?]=? where item_id=?"; $db->query($sql,array($r1['place'],$r1['author'],$r1['item_id'])); } print $r['title']."...\n"; } ?>