스킨은 basic 이구요
관리자모드(도메인/adm) 특정페이지에서 csv파일이나 txt파일을 업로드 해서
자동으로 데이타베이스에 넣게 하고 싶은데
어떤 방법으로 해야될까요??
초보라 ㅠㅠ 질문이 좀 막연하긴 하지만 도와주세요 부탁드립니다
관리자모드(도메인/adm) 특정페이지에서 csv파일이나 txt파일을 업로드 해서
자동으로 데이타베이스에 넣게 하고 싶은데
어떤 방법으로 해야될까요??
초보라 ㅠㅠ 질문이 좀 막연하긴 하지만 도와주세요 부탁드립니다
댓글 3개
<?
$sub_menu = "400100";
include_once("./_common.php");
$g4[title] = "업직종 일괄 업로드";
include_once ("$g4[admin_path]/admin.head.php");
$xls_file = "./Excel/excel.xls";
$today = date('Ymd');
?>
<?
if (file_exists($xls_file)){
require_once './Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
// 여기 이부분에서 euc-kr 을 넣어 주면 한글을 이용할 수 있다.
$data->setOutputEncoding('utf-8');
$data->read($xls_dir.$xls_file);
//error_reporting(E_ALL ^ E_NOTICE);
for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
// re data setting start
$code = $data->sheets[0]['cells'][$i][1];
$name = $data->sheets[0]['cells'][$i][2];
// re data setting end
if($code){
if(!eregi("-", $code)){ // 대매뉴인지 분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', 'in');";
sql_query($query);
echo "<font color='red'>\"{$name}\"</font> 덤프완료</br>";
echo $query."<br>";
}else{ //중소분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', '');";
sql_query($query);
echo "\"{$name}\" <font color='red'>덤프완료</font></br>";
echo $query."<br>";
}
}
} // for end
}else{
echo "<p><font color='red'><b>XLS 파일이 없습니다.</b></font>";
}
?>
<?
include_once ("$g4[admin_path]/admin.tail.php");
?>
$sub_menu = "400100";
include_once("./_common.php");
$g4[title] = "업직종 일괄 업로드";
include_once ("$g4[admin_path]/admin.head.php");
$xls_file = "./Excel/excel.xls";
$today = date('Ymd');
?>
<?
if (file_exists($xls_file)){
require_once './Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
// 여기 이부분에서 euc-kr 을 넣어 주면 한글을 이용할 수 있다.
$data->setOutputEncoding('utf-8');
$data->read($xls_dir.$xls_file);
//error_reporting(E_ALL ^ E_NOTICE);
for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
// re data setting start
$code = $data->sheets[0]['cells'][$i][1];
$name = $data->sheets[0]['cells'][$i][2];
// re data setting end
if($code){
if(!eregi("-", $code)){ // 대매뉴인지 분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', 'in');";
sql_query($query);
echo "<font color='red'>\"{$name}\"</font> 덤프완료</br>";
echo $query."<br>";
}else{ //중소분류
$query = "INSERT INTO g4_sector VALUES('', '{$code}', '{$name}', '업직종', '', '');";
sql_query($query);
echo "\"{$name}\" <font color='red'>덤프완료</font></br>";
echo $query."<br>";
}
}
} // for end
}else{
echo "<p><font color='red'><b>XLS 파일이 없습니다.</b></font>";
}
?>
<?
include_once ("$g4[admin_path]/admin.tail.php");
?>
게시글 목록
| 번호 | 제목 |
|---|---|
| 284508 | |
| 284499 | |
| 284492 | |
| 284490 | |
| 284484 | |
| 284481 | |
| 284478 | |
| 284476 | |
| 284474 | |
| 284472 | |
| 284470 | |
| 284458 | |
| 284457 | |
| 284454 | |
| 284453 | |
| 284447 | |
| 284446 | |
| 284444 | |
| 284441 | |
| 284440 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기