YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > PHP
검색
멤버이름    오토
비밀번호 
 

적수보드 ->제로보드 디비 컨버트

페이지 정보

작성자 MintState 댓글 0건 조회 13,470회 작성일 08-11-03 10:19

본문

적수보드 ->제로보드 디비 컨버트
 
이미 있을지도 모르지만 제가 못찾아서 삽질을 해보았습니다.
하나의 디비에 두개의 테이블이 있어야 합니다.
free(적수보드) -> nfree(제로보드) 변환 입니다.

대충 만들었습니다.  적당한 부분수정해주세요.
http://localhost/convert_nalabi.php 하세요

소스 -------------------->
<? 
#require "config.php"; 

// Configuration Variables;        // 수정 요망 
$host = "localhost"; 
$user = "root"; 
$passwd = ""; 
$db = "nalabi"; 

// zero board name 
$id = "nfree";        // 아래 URL에 맞도록 수정해주세요 

// db connection 
$connect = @mysql_connect( $host, $user, $passwd ) or die( "db connection error!" ); 

@mysql_select_db( $db, $connect ) or die( "db selection error!"); 

$head_no = 0; 
$total = 0; 

// 적수 보드 테이블을 쿼리 한다. 
$query = "SELECT * FROM free ORDER BY idx asc"; 

$query_result = mysql_query( $query ); 

print "no, num, idx, date, host, name, passwd, email, url, title, refer, reyn, reno, rede, reto, html, moder<br>"; 
while($hash = mysql_fetch_array( $query_result )) 
{ 

    $ListNumber = $total; 
    $prev_no = $ListNumber + 1 + 1; 
    $next_no = $ListNumber + 1 - 1; 
    $headnum = -$ListNumber; 

    // 적수 보드의 내용을 가져온다. 
    //print "$hash[no], $hash[num], $hash[idx], $hash[date], $hash[host],  $hash[name], $hash[passwd], $hash[email], $hash[url], $hash[title], $hash[refer], $hash[reyn], $hash[reno], $hash[rede], $hash[reto], $hash[html], $hash[moder]<br>"; 

    // 특수문자 변환, ' 
    $title_string=eregi_replace("'","'", $hash[title]); 
    if($title_string) print "$title_string<br>"; 
    else $title_string = $hash[title]; 

    $text_string=eregi_replace("'","'", $hash[text]); 
    if($text_string) print "aaaa<br>"; 
    else $title_string = $hash[title]; 


    // 제로보드에 추가한다. 
    $query = "insert into zetyx_board_$id (headnum, prev_no, next_no, memo,ip, name,homepage,email,subject,use_html,hit,reg_date,depth) values ($headnum, $prev_no, $next_no, '$text_string','$hash[host]','$hash[name]','$hash[url]','$hash[email]','$title_string','1','$hash[refer]','$hash[date]','$hash[rede]' )"; 
    //print $query."<br><br><br>"; 
    //mysql_query( $query ) or die("Invalid query: <br><br>" . mysql_error()); 
    mysql_query( $query ); 
    //print "$ListNumber, $hash[name], $hash[reyn], $hash[reno], $hash[reto]<br>"; 
    $total = $total + 1; 

} 

// update headnum 
$query = "select headnum from zetyx_board_$id where no='1'"; 
$query_result = mysql_query( $query ); 
$temp = mysql_fetch_array( $query_result ); 
$head_offset = -$temp[0] - 1; 
$query = "update zetyx_board_$id set headnum = headnum + $head_offset"; 
mysql_query( $query ); 

// update total articles 
$query = "update zetyx_admin_table set total_article='$total' where name='$id'"; 
mysql_query( $query ); 

// update division 
$query = "update zetyx_division_$id set num='$total' where no='1'"; 
mysql_query( $query ); 

?>

댓글목록

등록된 댓글이 없습니다.

Total 165건 5 페이지
PHP 목록
번호 제목 글쓴이 조회 날짜
65 MintState 19248 11-03
64 MintState 26161 11-03
63 MintState 12777 11-03
62 MintState 18636 11-03
61 MintState 20604 11-03
60 MintState 15211 11-03
59 MintState 14344 11-03
58 MintState 11951 11-03
57 MintState 12259 11-03
56 MintState 18238 11-03
55 MintState 15031 11-03
54 MintState 16135 11-03
53 MintState 16958 11-03
52 MintState 12423 11-03
51 MintState 12301 11-03
50 MintState 13020 11-03
49 MintState 13139 11-03
48 MintState 14341 11-03
열람중 MintState 13471 11-03
46 MintState 13503 11-03
45 MintState 14388 10-31
44 MintState 12250 10-31
43 MintState 12577 10-31
42 MintState 15037 10-31
41 MintState 10769 10-31
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™