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
|
<?php include("./_common.php");
exit;
$f1['fname'] = "./data/Product_notification_170223.xls"; $f1['sheet'][0]['name'] = 'TOUCH'; $f1['sheet'][0]['rows'] = 6; $f1['sheet'][0]['cols'] = 343; $xls_file[] = $f1;
include_once($j3_lib_path.'/Excel/reader.php');
for($x=0;$x<count($xls_file);$x++){ $f_idx = $x; $file = $xls_file[$f_idx]['fname'];
$data = new Spreadsheet_Excel_Reader(); // Set output Encoding. $data->setOutputEncoding('UTF-8'); $data->read($file);
$sql = "delete from zom_prod_noti where 1=1 "; mysql_query($sql,$connect_j3);
foreach($xls_file[$f_idx]['sheet'] as $key=>$sheets){ //_pr($key); $rows = $sheets['rows']; $cols =$sheets['cols'];
$cnt = 0; for($i=2;$i<=$cols;$i++){ $j=1; $type_name = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $type_code = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $item_desc = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $item_code = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $item_type = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $item_bigo = addslashes($data->sheets[$key]['cells'][$i][$j]); $j++; $sql = "insert into zom_prod_noti set type_name = '{$type_name}', type_code = '{$type_code}', item_desc = '{$item_desc}', item_code = '{$item_code}', item_type = '{$item_type}', item_bigo = '{$item_bigo}' "; mysql_query($sql,$connect_j3); } } }
?>
|