/home/mjc1/public_html/j3demo/xls_update2.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
include("./_common.php");

exit;

$f1['fname'] = "./data/변환된_베트남2F_E52 T-FOG_TOUCH번역_VN.xls";
$f1['rows'] = 8;
$f1['cols'] = 3869;
$xls_file[] = $f1;

$f2['fname'] = "./data/변환된_베트남2F_E52_COF_TOUCH번역_VN.xls";
$f2['rows'] = 11;
$f2['cols'] = 4569;
$xls_file[] = $f2;

$f3['fname'] = "./data/변환된_베트남2F_E52_FOF_TOUCH번역_VN.xls";
$f3['rows'] = 8;
$f3['cols'] = 3960;
$xls_file[] = $f3;

include_once(
$j3_lib_path.'/Excel/reader.php');

for(
$x=0;$x<count($xls_file);$x++){
    
//if($x=='1' || $x=='2'){ continue; }
    
$f_idx $x;
    
$file $xls_file[$f_idx]['fname'];
    
$rows $xls_file[$f_idx]['rows'];
    
$cols $xls_file[$f_idx]['cols'];

    
$data = new Spreadsheet_Excel_Reader();

    
// Set output Encoding.
    
$data->setOutputEncoding('UTF-8');

    
$data->read($file);

    
error_reporting(E_ALL E_NOTICE);

    
$cnt 0;
    for(
$i=1;$i<=$cols;$i++){
        for(
$j=1;$j<=$rows;$j++){
            
$code addslashes($data->sheets[0]['cells'][$i][$j]);
            if(
$code!=''){
                
$sql "select count(*) as cnt from xls_reader where xls_file = '{$f_idx}' and xls_alpha = '{$j}' and xls_no = '{$i}' and xls_conv = '' ";
                
$res mysql_query($sql,$connect_j3);
                
$info mysql_fetch_array($res);
                if(
$info['cnt']>0){
                    
$sqls "update xls_reader set xls_conv = '{$code}' where xls_file = '{$f_idx}' and xls_alpha = '{$j}' and xls_no = '{$i}' ;";
                    
_pr($sqls);
                }
            }
            
$cnt++;
        }
    }
}



?>