게시판 엑셀 업로드 질문 엑셀업데이트
본문
쇼핑몰 > 상품일괄등록 기능이랑 같습니다.
엑셀양식 다운로드기능까지는 같은데 양식을 입력 후 등록을 하면 500 오류가 뜨네요ㅠㅠ
이유가 너무궁금합니다.. dbconfig.php 에 설정되어있는 $g5['테이블'] 만 엑셀 업로드가 되는건가요??
등록하려는 테이블은 제가 새로 추가한 테이블입니다.
itemexcelupdate.php
<?php
//$sub_menu = '400300';
include_once('./_common.php');
// 상품이 많을 경우 대비 설정변경
set_time_limit ( 0 );
ini_set('memory_limit', '50M');
//auth_check($auth[$sub_menu], "w");
if($_FILES['excelfile']['tmp_name']) {
$file = $_FILES['excelfile']['tmp_name'];
include_once(G5_LIB_PATH.'/Excel/reader.php');
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('UTF-8');
/***
* if you want you can change 'iconv' to mb_convert_encoding:
* $data->setUTFEncoder('mb');
*
**/
/***
* By default rows & cols indeces start with 1
* For change initial index use:
* $data->setRowColOffset(0);
*
**/
/***
* Some function for formatting output.
* $data->setDefaultFormat('%.2f');
* setDefaultFormat - set format for columns with unknown formatting
*
* $data->setColumnFormat(4, '%.3f');
* setColumnFormat - set format for column (apply only to number fields)
*
**/
$data->read($file);
/*
$data->sheets[0]['numRows'] - count rows
$data->sheets[0]['numCols'] - count columns
$data->sheets[0]['cells'][$i][$j] - data from $i-row $j-column
$data->sheets[0]['cellsInfo'][$i][$j] - extended info about cell
$data->sheets[0]['cellsInfo'][$i][$j]['type'] = "date" | "number" | "unknown"
if 'type' == "unknown" - use 'raw' value, because cell contain value with format '0.00';
$data->sheets[0]['cellsInfo'][$i][$j]['raw'] = value if cell without format
$data->sheets[0]['cellsInfo'][$i][$j]['colspan']
$data->sheets[0]['cellsInfo'][$i][$j]['rowspan']
*/
error_reporting(E_ALL ^ E_NOTICE);
$succ_count = 0;
for ($i = 3; $i <= $data->sheets[0]['numRows']; $i++) {
$total_count++;
$j = 1;
$wr_subject = addslashes($data->sheets[0]['cells'][$i][$j++]);
$wr_1 = addslashes($data->sheets[0]['cells'][$i][$j++]);
$wr_2 = addslashes($data->sheets[0]['cells'][$i][$j++]);
$wr_3 = addslashes($data->sheets[0]['cells'][$i][$j++]);
$wr_4 = addslashes($data->sheets[0]['cells'][$i][$j++]);
$wr_5 = addslashes($data->sheets[0]['cells'][$i][$j++]);
$sql = " INSERT INTO gift_write_black_list
SET wr_subject = '$wr_subject',
wr_1 ='$wr_1',
wr_2 ='$wr_2',
wr_3 ='$wr_3',
wr_4 ='$wr_4',
wr_5 ='$wr_5' ";
sql_query($sql, true);
$succ_count++;
}
}
$g5['title'] = '등록 결과';
include_once(G5_PATH.'/head.sub.php');
?>
<div class="new_win">
<h1><?php echo $g5['title']; ?></h1>
<div class="local_desc01 local_desc">
<p>등록을 완료했습니다.</p>
</div>
<dl id="excelfile_result">
<dt>완료건수</dt>
<dd><?php echo number_format($succ_count); ?></dd>
</dl>
<div class="btn_win01 btn_win">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</div>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>