게시판 합치기 팁
페이지 정보
작성자 오원장쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 4,434회 작성일 14-03-21 13:20본문
<?
include "_common.php";
include "_common.php";
//table1에 table2의 레코드를 가져와 합치는 소스
$bo_tableA="table1";
$bo_tableB="table2";
$bo_tableB="table2";
$write_tableA=$g4[write_prefix].$bo_tableA;
$write_tableB=$g4[write_prefix].$bo_tableB;
sql_query("lock tables $write_tableA write,$write_tableB write ", false);
$write_tableB=$g4[write_prefix].$bo_tableB;
sql_query("lock tables $write_tableA write,$write_tableB write ", false);
$row=sql_fetch("select max(wr_id) as cnt from $write_tableA");
$plusCnt= $row[cnt] + 100;
echo $write_tableB.'==>'.$write_tableA.'<p>';
echo "<hr>";
$plusCnt= $row[cnt] + 100;
echo $write_tableB.'==>'.$write_tableA.'<p>';
echo "<hr>";
sql_query("INSERT INTO $write_tableA (wr_id ,wr_num, wr_reply, wr_parent ,wr_is_comment, wr_comment ,wr_comment_reply ,ca_name,wr_option,wr_subject,wr_content,wr_link1,wr_link2,wr_link1_hit,wr_link2_hit,wr_trackback,wr_hit,wr_good,wr_nogood,mb_id,wr_password,wr_name,wr_email,wr_homepage,wr_datetime,wr_last,wr_ip,wr_1,wr_2,wr_3,wr_4,wr_5,wr_6,wr_7,wr_8,wr_9,wr_10 )
select wr_id+$plusCnt, wr_num-$plusCnt,wr_reply, wr_parent+$plusCnt,wr_is_comment,wr_comment,wr_comment_reply,ca_name,wr_option,wr_subject,wr_content,wr_link1,wr_link2,wr_link1_hit,wr_link2_hit,wr_trackback,wr_hit,wr_good,wr_nogood,mb_id,wr_password,wr_name,wr_email,wr_homepage,wr_datetime,wr_last,wr_ip,wr_1,wr_2,wr_3,wr_4,wr_5,wr_6,wr_7,wr_8,wr_9,wr_10 from $write_tableB ");
select wr_id+$plusCnt, wr_num-$plusCnt,wr_reply, wr_parent+$plusCnt,wr_is_comment,wr_comment,wr_comment_reply,ca_name,wr_option,wr_subject,wr_content,wr_link1,wr_link2,wr_link1_hit,wr_link2_hit,wr_trackback,wr_hit,wr_good,wr_nogood,mb_id,wr_password,wr_name,wr_email,wr_homepage,wr_datetime,wr_last,wr_ip,wr_1,wr_2,wr_3,wr_4,wr_5,wr_6,wr_7,wr_8,wr_9,wr_10 from $write_tableB ");
sql_query(" unlock tables ", false);
$filePathA=$g4[path].'/data/file/'.$bo_tableA;
$filePathB=$g4[path].'/data/file/'.$bo_tableB;
$dir=@opendir($filePathB);
while($file=readdir($dir)) {
if ($file=='.' || $file=='..') continue;
echo 'file copy : '.$file.'<br>';
@copy($filePathB.'/'.$file, $filePathA.'/'.$file);
@unlink($filePathB.'/'.$file);
}
while($file=readdir($dir)) {
if ($file=='.' || $file=='..') continue;
echo 'file copy : '.$file.'<br>';
@copy($filePathB.'/'.$file, $filePathA.'/'.$file);
@unlink($filePathB.'/'.$file);
}
sql_query("update $g4[board_file_table] set bo_table='$bo_tableA', wr_id = wr_id + $plusCnt where bo_table='$bo_tableB'");
?>
<hr>
OK
<hr>
OK
댓글목록
등록된 댓글이 없습니다.