질문하나 드립니다.
본문
현제 제가 어려움이 좀 있어 이렇게 문의 드립니다.
아래 두가지 파일에 대한 소스 먼저 올려 드립니다.
제가 질문 드릴 것은요
installation.php 에 보게 되면
if($mon){
$sql_mon = " where '{$mon1}' > regdate and '{$mon2}' < regdate ";
}
위 소스가 있습니다.
그래서 제가 모델명 왼쪽 필드에 일자 라는 필드를 하나 만들고 그 자리에 install_from.php에서 작성하게 되면 일자에 작성한 날자가 나타나게 하고 싶습니다.
어떻게 하는지 궁금 합니다.
참고로 regdate는 DB테이블에도 생서이 되어 있고 종류로는 timestamp로 되어 있습니다.
이 코드를 가지고 나타나게 할 수 있는지요
아님 이게 안된다면 다른 방법이 있으신 궁금 합니다.
installation.php
<?php
$sub_menu = '400900';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$year = date("Y");
$mon1 = $year."-".$mon."-31 23:59:59";
$mon2 = $year."-".$mon."-01 00:00:00";
if($mon){
$sql_mon = " where '{$mon1}' > regdate and '{$mon2}' < regdate ";
}
$g5['title'] = '설치관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$sql_common = " from g5_installation where (1) ";
if($stx) {
$sql_common .= " and ".$sfl." LIKE '%".$stx."%' ";
}
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_mon. "". $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = "select * $sql_common $sql_mon order by idx desc limit $from_record, {$config['cf_page_rows']} ";
$result = sql_query($sql);
//echo $sql."/sql<br>";
?>
<div class="local_ov01 local_ov">
<?php if ($page > 1) {?><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>">처음으로</a><?php } ?>
<span>전체 <?php echo $total_count; ?>건</span>
</div>
<div class="local_desc01 local_desc">
<ol>
<li>엑셀파일 업로드방법</li>
<li>오른쪽 링크파일을 다운로드 받아 엑셀로 파일열기를 합니다. => <b><a href='http://pcholic.co.kr/sample1.zip'>클릭</a></b></li>
<li>관련내용들을 기록후 저장시, <strong>txt(탭으로 분리)</strong> 로 저장합니다.</li>
<li>저장후 저장한 파일을 더블클릭후 내용모두를 오른쪽 링크파일안에 붙혀넣기를 합니다. =><b><a href='http://pcholic.co.kr/sample2.zip'>클릭</a></b></li>
<li>저장후 업로드하면 되고, 불필요한 라인들은 삭제합니다.</li>
</ol>
</div>
<div class="btn_add01 btn_add">
<span style="float:left;">
<input type="button" id="<?=$i?>" name="<?=$i?>" value="전체보기" onclick="location.href='/adm/shop_admin/installation.php'">
<? for($i=1;$i<13;$i++){?>
<input type="button" id="<?=$i?>" name="<?=$i?>" value="<?=$i?>월" onclick="location.href='/adm/shop_admin/installation.php?mon=<?=$i?>'">
<?}?>
</span>
<a href="./install_form.php">설치추가</a>
</div>
<form name="forderprint" action="./excel_upload.php" method='post' enctype='multipart/form-data'>
<table width="100%">
<tr>
<td width="110" class="pad_t10">엑셀파일<br />업로드<b>(*.txt)</b></td>
<td>
<input type="file" name="fr_od_id" size="30" maxlength="10" class="ed"><br />
<b>엑셀 확장자를 txt(탭으로 분리)로 저장 후 업로드</b>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="btn1" value="엑셀파일 업로드"></td>
</tr>
</table>
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col" width="2%">번호</th>
<th scope="col" width="3%">일자</th>
<th scope="col" width="6%">모델명</th>
<th scope="col" width="5%">이름</th>
<th scope="col" width="5%">담당기사</th>
<th scope="col" width="4%">전화번호</th>
<th scope="col" width="20%">주소</th>
<th scope="col" width="5%">설치유형</th>
<th scope="col" width="4%">처리사항</th>
<th scope="col" width="2%">삭제</th>
</tr>
</thead>
<tbody>
<?php for ($i=0; $row=sql_fetch_array($result); $i++) {
$sql1 = " select COUNT(*) as cnt from {$g5['faq_table']} where fm_id = '{$row['fm_id']}' ";
$row1 = sql_fetch($sql1);
$cnt = $row1['cnt'];
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $row['idx']; ?></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['regdate']; ?>&w=u">
<?php echo $member['regdate'] ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['model']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['name']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['enginieer']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['tel']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['addr']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['type']; ?></a></td>
<td class="td_num">
<a href="./install_form.php?idx=<?php echo $row['idx']; ?>&w=u">
<?php echo $row['proc']; ?></a></td>
<td class="td_mng">
<a href="./install_form_update.php?idx=<?=$row['idx']?>&w=d"><span class="sound_only"> </span>삭제</a>
</td>
</tr>
<?php
}
if ($i == 0){
echo '<tr><td colspan="100" class="empty_table"><span>자료가 한건도 없습니다.</span></td></tr>';
}
?>
</tbody>
</table>
</div>
<!--검색박스 시작-->
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="<?=$i?>">
<option value="model">모델명</option>
<option value="name">이름</option>
<option value="enginieer">담당기사</option>
<option value="addr">주소</option>
<option value="type">설치유형</option>
<option value="proc">처리사항</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="" id="stx" required class="required frm_input">
<input type="submit" class="btn_submit" value="검색">
</form>
<center>
<script>
function printWindow() {
bv = parseint(navigator.appversion);
if (bv)=4) window.print();
}
var tempBody;
window.onbeforeprint = function() {
tempBody = document.body.innerHTML;
document.body.innerHTML = pri.innerHTML;
}
window.onafterprint = function() {
document.body.innerHTML = tempBody;
}
</script>
<body>
<!--
인쇄영역 숨김
<div id="pri"> 인쇄할영역 </div>
비인쇄할영역<br />
<a href="javascrpt:printWindow();">인쇄하기</a>
-->
<a href="#" onclick="javascript:print();">인쇄하기</a>
</body>
<!--검색박스 끝-->
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page="); ?>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>
install_from.php
<?php
$sub_menu = '400900';
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
auth_check($auth[$sub_menu], "w");
$html_title = '설치';
if ($w == "u")
{
$html_title .= ' 수정';
$readonly = ' readonly';
$sql = " select * from g5_installation where idx = '$idx' ";
$il = sql_fetch($sql);
if (!$il['idx']) alert('등록된 자료가 없습니다.');
}
else
{
$html_title .= ' 입력';
}
$g5['title'] = $html_title.' 관리';
//수량(재고)
if (!$it_id_cnt){
$cnt = $il[count];
}else{
$sql_cnt = "select *
from g5_shop_item a ,
g5_shop_category b
where (a.ca_id = b.ca_id) and a.it_name = '{$it_id_cnt}'
order by a.pt_num desc, it_name asc
";
$res_cnt = sql_fetch($sql_cnt);
$cnt = $res_cnt[it_stock_qty];
}
include_once (G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="frmfaqmasterform" action="./install_form_update.php" onsubmit="return frmfaqmasterform_check(this);" method="post" enctype="MULTIPART/FORM-DATA">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="idx" value="<?php echo $idx; ?>">
<input type="hidden" name="token" value="">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="fm_order">일자</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['regdate']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">모델명</label></th>
<td>
<select name="model" id="model" onchange="location.href='/adm/shop_admin/install_form.php?it_id_cnt='+this.value+'&idx=<?=$idx?>&w=<?=$w?>'">
<?
$sql = "select *
from g5_shop_item a ,
g5_shop_category b
where (a.ca_id = b.ca_id) and a.ca_id2 = '5020'
order by a.pt_num desc, it_name asc
";
$result = sql_query($sql);
for ($i=0; $row2=sql_fetch_array($result); $i++) {
?>
<option value="<?=$row2[it_name]?>"
<? if($it_id_cnt){?>
<? if($row2[it_name]==$it_id_cnt){?>selected<?}?>
<? }else{?>
<? if($row2[it_name]==$il[model]){?>selected<?}?>
<? }?>
><?=$row2[it_name]?></option>
<? }?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">수량(재고)</label></th>
<td>
<input type="text" name="cnt" value="<?php echo $cnt; ?>" id="cnt" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">설치비</label></th>
<td>
<input type="text" name="pay" value="<?php echo $il['pay']; ?>" id="pay" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">담당설치기사</label></th>
<td>
<select name="enginieer" id="enginieer">
<?
$sql = "select * from g5_member where mb_level = '5' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
?>
<option value="<?=$row[mb_name]?>/<?=$row[mb_id]?>"
<? if($row[mb_name]==$il[enginieer]){?>selected<?}?>><?=$row[mb_name]?>(<?=$row[mb_nick]?>)</option>
<? }?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">이름</label></th>
<td>
<input type="text" name="name" value="<?php echo $il['name']; ?>" id="name" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">전화번호</label></th>
<td>
<input type="text" name="tel" value="<?php echo $il['tel']; ?>" id="tel" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">주소</label></th>
<td>
<input type="text" name="addr" value="<?php echo $il['addr']; ?>" id="addr" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">설치유형</label></th>
<td>
<select name="type" id="type">
<option value="스탠드형 벽걸이" <? if($il[type]=='스탠드형 벽걸이'){?>selected<?}?>>스탠드형 벽걸이</option>
<option value="고정형 벽걸이" <? if($il[type]=='고정형 벽걸이'){?>selected<?}?>>고정형 벽걸이</option>
<option value="회전형 벽걸이" <? if($il[type]=='회전형 벽걸이'){?>selected<?}?>>회전형 벽걸이</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지1</label></th>
<td>
<input type="file" name="idx_1img" id="idx_1img">
<?php
$himg = G5_DATA_PATH.'/elist/'.$il['idx'].'_1';
if (file_exists($himg)) {
$size = @getimagesize($himg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_1img_del" value="1" id="idx_1img_del"> <label for="idx_1img_del">삭제</label>';
$himg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_1" width="'.$width.'" alt="">';
}
if ($himg_str) {
echo '<div class="banner_or_img">';
echo $himg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지2</label></th>
<td>
<input type="file" name="idx_2img" id="idx_2img">
<?php
$timg = G5_DATA_PATH.'/elist/'.$il['idx'].'_2';
if (file_exists($timg)) {
$size = @getimagesize($timg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_2img_del" value="1" id="idx_2img_del"><label for="idx_2img_del">삭제</label>';
$timg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_2" width="'.$width.'" alt="">';
}
if ($timg_str) {
echo '<div class="banner_or_img">';
echo $timg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_himg">이미지3</label></th>
<td>
<input type="file" name="idx_3img" id="idx_3img">
<?php
$timg = G5_DATA_PATH.'/elist/'.$il['idx'].'_3';
if (file_exists($timg)) {
$size = @getimagesize($timg);
if($size[0] && $size[0] > 750)
$width = 350;
else
$width = $size[0];
echo '<input type="checkbox" name="idx_3img_del" value="1" id="idx_3img_del"><label for="idx_3img_del">삭제</label>';
$timg_str = '<img src="'.G5_DATA_URL.'/elist/'.$il['idx'].'_3" width="'.$width.'" alt="">';
}
if ($timg_str) {
echo '<div class="banner_or_img">';
echo $timg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">기사에게 전달 기타사항</label></th>
<td>
<textarea id="fm_order" class="frm_input" name="etc_admin" id="etc_admin" rows="3"><?=$il[etc_admin]?></textarea>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">관리자에게 전달 기타사항</label></th>
<td>
<textarea id="fm_order" class="frm_input" name="etc_admin" id="etc_admin" rows="3"><?=$il[etc_out]?></textarea>
</td>
</tr>
<tr>
<th scope="row"><label for="fm_order">처리사항</label></th>
<td>
<select name="proc" id="proc">
<option value="설치대기" <? if($il[proc]=='설치대기'){?>selected<?}?>>설치대기</option>
<option value="설치중" <? if($il[type]=='설치중'){?>selected<?}?>>설치중</option>
<option value="설치완료" <? if($il[type]=='설치완료'){?>selected<?}?>>설치완료</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./installation.php">목록</a>
</div>
</form>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>