바쁘실텐데.. 꼭좀 도와주세요 db에 저장된 숫자를 문자로 표현.. 정보
바쁘실텐데.. 꼭좀 도와주세요 db에 저장된 숫자를 문자로 표현..본문
제가 프로그램에는 너무 잘 몰라서요...
회사내에서 밥먹는 인원을 파악하기 위해서 프로그램을 짜고 있는데요...
식사 인원을 구할려고 하니... 문자는 합산이 않될것 같아서... 식사를 하는사람을 1 않하는 사람의 값을 0 으로 표현하고 있습니다.
그런데... 표기될때도 마찬가지로 식사 하는 사람이 "식사" 이런식으로 표현되어야 하는데 "1"이라는 숫자로 표시가 되어서 염치 불구하고 잘아시는 분들께 조언을 구해봅니다.
===============================================================================================
소스 내용 입니다.
==============================================================================================
<?
include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$row_my=array();
$sql2 = "select gr_id,bo_table,bo_subject from $g4[board_table] where bo_table !='datatest' order by gr_id,bo_table";
$result2 = sql_query($sql2);
for($mi=0; $row2=sql_fetch_array($result2); $mi++){
$tmp_write_table ="";
$tmp_write_table = $g4[write_prefix] . $row2[bo_table];
$sql3 = "select * from $tmp_write_table where wr_is_comment = 0 order by wr_id"; //원글만
$result3 = sql_query($sql3);
$old_res_cnt=$res_cnt; $tmp_res_cnt="";
$tmp_res_cnt=mysql_num_rows($result3); //게시판별 구한수
$res_cnt=$old_res_cnt+$tmp_res_cnt;
$old_wr_hit=$res_wr_hit; $res_wr_hit="";
$tmp_wr_hit=@mysql_result(@mysql_query("select sum(wr_hit) from $tmp_write_table"),0,0);
$res_wr_hit=$old_wr_hit+$tmp_wr_hit;
$res_wr_hit1=number_format($res_wr_hit);
}//for
$time = date("Y-m-d");
$target1 = "1";
$target = "0";//지정일(지정일 이후에 등록된 글만 추출하기 위함(by nasca)
$duration = date("Y-m-d", $g4[server_time] - ($target * 86400));
$duration1 = date("Y-m-d", $g4[server_time] + ($target1 * 86400));
$sql = " select count(bn_id) as cnt from $g4[board_new_table]
where bn_datetime between '$duration' and '$duration1'
order by bn_datetime ";
$row = sql_fetch($sql);
$width= "97%";
?>
<?php
include_once($board_skin_path . '/lib/skin.lib.php');
$VAR['today'] = date('Ymd');
$VAR['select'] = date('Ym');
if(preg_match('/^[0-9]{6}$/', $_GET['schedule_ym']) == true && checkdate(substr($_GET['schedule_ym'], 4, 2), 1, substr($_GET['schedule_ym'], 0, 4)) == true) $VAR['select'] = $_GET['schedule_ym'];
$VAR['timestamp'] = strtotime($VAR['select'] . '01');
$VAR['weekday'] = date('w', $VAR['timestamp']);
$VAR['count'] = date('t', $VAR['timestamp']) + $VAR['weekday'] + 1;
$VAR['path'] = "{$g4['bbs_path']}/board.php?bo_table={$bo_table}";
$col_width = "14%";
if($_GET[room])
$room = $_GET[room];
else
$room = 1;
$room_arr = array(1=>"총무팀", "생산팀", "구매자재팀", "품질경영팀", "위성사업팀", "연구소");
?>
<style type="text/css">
/* 카테고리 스타일*/
#box_day{width:3%; padding-left: 7px; padding-top: 4px; font-size:12px; font-family:돋움; font-weight:bold; float:left;}
#box_list{width:97%;}
#box_list2{width:97%; padding:5px 7px 5px 7px;}
a.day1:link, a.day1:visited, a.day1:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day1:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
a.day2:link, a.day2:visited, a.day2:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day2:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
a.day3:link, a.day3:visited, a.day3:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day3:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
.day4 {font-size:20px;color:#1641b2;}
.day5 {font-family:돋움;font-size:14px;color:#6c91c3;}
</style>
<link rel="stylesheet" type="text/css" href="<?php echo $board_skin_path; ?>/css/list.skin.css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/list.skin.js" charset="<?php echo $g4['charset']; ?>"></script>
<link rel="stylesheet" href="<?php echo $board_skin_path; ?>/css/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/dhtmlwindow.js"></script>
<link rel="stylesheet" href="<?php echo $board_skin_path; ?>/css/modal.css" type="text/css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/modal.js"></script>
<script language="javascript">
function open_dialog(){
dialog = dhtmlmodal.open('write_conference', 'iframe', '<?=$g4[path]?>/bbs/write.php?bo_table=<?=$bo_table?>&mode=layer&room=<?=$room?>', 'S&T', 'width=580px,height=304px,center=1,resize=0,scrolling=0');
}
</script>
<table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif">
<tr>
<td width="10"> </td>
<td valign="bottom">
<? if($room==2){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==3){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==4){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==5){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==6){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s_06.gif" border=0>
<? } else {?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } ?>
</td>
<td align="right">
<div align="right">
<?php if($admin_href || $write_href){ ?>
<?php if($admin_href) echo "<img name=\"admin\" alt=\"관리자\" src=\"{$board_skin_path}/img/btn_admin.gif\" style='cursor:hand' onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?//php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"회의실 예약\" class=\"button\" onclick=\"open_dialog();\" />"; ?>
<?php if($write_href) echo "<img name=\"reg\" alt=\"회의실 예약\" src=\"{$board_skin_path}/img/reg.gif\" style='cursor:hand' onclick=\"open_dialog();\" />"; ?>
<?php } ?>
</div>
</td>
</tr>
</table> <!-- ▶이거까지 ☞ -->
<!-- 관리자면 않보이게 처리
<? if (!$is_admin) {?>
<table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif">
<tr>
<td width="10"> </td>
<td valign="bottom">
</td>
<td align="right">
<div align="right">
<?php if($admin_href || $write_href){ ?>
<?php if($admin_href) echo "<img name=\"admin\" alt=\"관리자\" src=\"{$board_skin_path}/img/btn_admin.gif\" style='cursor:hand' onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?//php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"회의실 예약\" class=\"button\" onclick=\"open_dialog();\" />"; ?>
<?php if($write_href) echo "<img name=\"reg\" alt=\"회의실 예약\" src=\"{$board_skin_path}/img/reg.gif\" style='cursor:hand' onclick=\"open_dialog();\" />"; ?>
<?php } ?>
</div>
</td>
</tr>
</table><? } ?> 처리끝 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbline1">
<tr>
<td align=center colspan=7 height=40>
<div>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('-1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_prev_month.gif" alt="이전달" border=0 /></a>
<span class="day4"><?php echo date('Y', $VAR['timestamp']); ?></span><span class="day5">년</span>
<span class="day4"><?php echo date('n', $VAR['timestamp']); ?></span><span class="day5">월</span>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('+1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_next_month.gif" alt="다음달" border=0 /></a>
</div>
</td>
</tr>
<tr>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">일</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">월</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">화</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">수</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">목</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">금</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">토</td>
</tr>
<tr>
<?php
for($i = $row = 1; $i < $VAR['count']; $i++, $row++)
{
$date = $i - $VAR['weekday'];
if($date < 1) echo '<td class="tbline2" bgcolor=#F9F9F9> </td>';
else
{
$wr_1 = $VAR['select'] . sprintf('%02d', $date);
$schedule = null;
// 현재날짜로 끝
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 <> '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:left;\"><img src='img/1.png' align=absmiddle width=13> <a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid');\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_subject']} ~{$result['wr_4']}</a></div>";
}
// 당일꺼 뽑아내기
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ORDER BY wr_2 ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$result['wr_content']}</font></div>";
}
// 현재날짜부터 시작
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 <> '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:right;\"><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_2']}~ {$result['wr_subject']}</a> <img src='img/1.png' align=absmiddle width=13></div>";
}
// 기간 사이
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 < '{$wr_1}' AND wr_3 > '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:center;\"><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_subject']}</a> <img src='img/1.png' align=absmiddle width=12></div>";
}
========================================================================================
표현되는곳이 // 당일꺼 뽑아내기 에서
{$result['wr_content']} 입니다.... 부디 아시는분들 꼭좀 도와주세요... 부탁드립니다.
mickey1377 12-01-19 11:12
$result['wr_content'] << 이게 식사를 구분하는 1 ,0 이라면
if($result['wr_content'] == '1'){
echo "식사"
}else{
echo "식사안함"
}
이렇게 하면 되지 않나요?
=========================================================================================
herius 12-01-19 13:50
위와 같이 하면 오류가 발생하네요.. ㅜ.ㅠ; 어떻게 하면 좋죠... .ㅜ.ㅠ;
==================================================================================
뽁스 12-01-19 14:14
위의 답변에서
echo "식사";
}else{
echo "식사안함";
}
로 해야됩니다.
echo "식사" 뒤에 ; 이 빠졌어요
----------------------------------------------------------------------------------
위에서 가르켜 주신대로 이 부분에 넣으니깐.. 계속 에러가 나네요.. 초보라서요... 꼭좀 알려주세요.
-------------------------------------------------------------------------------------------
// 당일꺼 뽑아내기
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ORDER BY wr_2 ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$result['wr_content']}</font></div>";
}
회사내에서 밥먹는 인원을 파악하기 위해서 프로그램을 짜고 있는데요...
식사 인원을 구할려고 하니... 문자는 합산이 않될것 같아서... 식사를 하는사람을 1 않하는 사람의 값을 0 으로 표현하고 있습니다.
그런데... 표기될때도 마찬가지로 식사 하는 사람이 "식사" 이런식으로 표현되어야 하는데 "1"이라는 숫자로 표시가 되어서 염치 불구하고 잘아시는 분들께 조언을 구해봅니다.
===============================================================================================
소스 내용 입니다.
==============================================================================================
<?
include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$row_my=array();
$sql2 = "select gr_id,bo_table,bo_subject from $g4[board_table] where bo_table !='datatest' order by gr_id,bo_table";
$result2 = sql_query($sql2);
for($mi=0; $row2=sql_fetch_array($result2); $mi++){
$tmp_write_table ="";
$tmp_write_table = $g4[write_prefix] . $row2[bo_table];
$sql3 = "select * from $tmp_write_table where wr_is_comment = 0 order by wr_id"; //원글만
$result3 = sql_query($sql3);
$old_res_cnt=$res_cnt; $tmp_res_cnt="";
$tmp_res_cnt=mysql_num_rows($result3); //게시판별 구한수
$res_cnt=$old_res_cnt+$tmp_res_cnt;
$old_wr_hit=$res_wr_hit; $res_wr_hit="";
$tmp_wr_hit=@mysql_result(@mysql_query("select sum(wr_hit) from $tmp_write_table"),0,0);
$res_wr_hit=$old_wr_hit+$tmp_wr_hit;
$res_wr_hit1=number_format($res_wr_hit);
}//for
$time = date("Y-m-d");
$target1 = "1";
$target = "0";//지정일(지정일 이후에 등록된 글만 추출하기 위함(by nasca)
$duration = date("Y-m-d", $g4[server_time] - ($target * 86400));
$duration1 = date("Y-m-d", $g4[server_time] + ($target1 * 86400));
$sql = " select count(bn_id) as cnt from $g4[board_new_table]
where bn_datetime between '$duration' and '$duration1'
order by bn_datetime ";
$row = sql_fetch($sql);
$width= "97%";
?>
<?php
include_once($board_skin_path . '/lib/skin.lib.php');
$VAR['today'] = date('Ymd');
$VAR['select'] = date('Ym');
if(preg_match('/^[0-9]{6}$/', $_GET['schedule_ym']) == true && checkdate(substr($_GET['schedule_ym'], 4, 2), 1, substr($_GET['schedule_ym'], 0, 4)) == true) $VAR['select'] = $_GET['schedule_ym'];
$VAR['timestamp'] = strtotime($VAR['select'] . '01');
$VAR['weekday'] = date('w', $VAR['timestamp']);
$VAR['count'] = date('t', $VAR['timestamp']) + $VAR['weekday'] + 1;
$VAR['path'] = "{$g4['bbs_path']}/board.php?bo_table={$bo_table}";
$col_width = "14%";
if($_GET[room])
$room = $_GET[room];
else
$room = 1;
$room_arr = array(1=>"총무팀", "생산팀", "구매자재팀", "품질경영팀", "위성사업팀", "연구소");
?>
<style type="text/css">
/* 카테고리 스타일*/
#box_day{width:3%; padding-left: 7px; padding-top: 4px; font-size:12px; font-family:돋움; font-weight:bold; float:left;}
#box_list{width:97%;}
#box_list2{width:97%; padding:5px 7px 5px 7px;}
a.day1:link, a.day1:visited, a.day1:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day1:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
a.day2:link, a.day2:visited, a.day2:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day2:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
a.day3:link, a.day3:visited, a.day3:active { font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day3:hover { font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }
.day4 {font-size:20px;color:#1641b2;}
.day5 {font-family:돋움;font-size:14px;color:#6c91c3;}
</style>
<link rel="stylesheet" type="text/css" href="<?php echo $board_skin_path; ?>/css/list.skin.css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/list.skin.js" charset="<?php echo $g4['charset']; ?>"></script>
<link rel="stylesheet" href="<?php echo $board_skin_path; ?>/css/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/dhtmlwindow.js"></script>
<link rel="stylesheet" href="<?php echo $board_skin_path; ?>/css/modal.css" type="text/css" />
<script type="text/javascript" src="<?php echo $board_skin_path; ?>/js/modal.js"></script>
<script language="javascript">
function open_dialog(){
dialog = dhtmlmodal.open('write_conference', 'iframe', '<?=$g4[path]?>/bbs/write.php?bo_table=<?=$bo_table?>&mode=layer&room=<?=$room?>', 'S&T', 'width=580px,height=304px,center=1,resize=0,scrolling=0');
}
</script>
<table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif">
<tr>
<td width="10"> </td>
<td valign="bottom">
<? if($room==2){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==3){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==4){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==5){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } else if($room==6){?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s2_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s_06.gif" border=0>
<? } else {?>
<a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=1'><img src="<?=$board_skin_path?>/img/btn_s_01.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=2'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=3'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=4'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=5'><img src="<?=$board_skin_path?>/img/btn_s2_05.gif" border=0></a><a href='board.php?<?=($_GET[schedule_ym])?"schedule_ym=$_GET[schedule_ym]&":""?>bo_table=<?=$bo_table?>&room=6'><img src="<?=$board_skin_path?>/img/btn_s2_06.gif" border=0>
<? } ?>
</td>
<td align="right">
<div align="right">
<?php if($admin_href || $write_href){ ?>
<?php if($admin_href) echo "<img name=\"admin\" alt=\"관리자\" src=\"{$board_skin_path}/img/btn_admin.gif\" style='cursor:hand' onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?//php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"회의실 예약\" class=\"button\" onclick=\"open_dialog();\" />"; ?>
<?php if($write_href) echo "<img name=\"reg\" alt=\"회의실 예약\" src=\"{$board_skin_path}/img/reg.gif\" style='cursor:hand' onclick=\"open_dialog();\" />"; ?>
<?php } ?>
</div>
</td>
</tr>
</table> <!-- ▶이거까지 ☞ -->
<!-- 관리자면 않보이게 처리
<? if (!$is_admin) {?>
<table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif">
<tr>
<td width="10"> </td>
<td valign="bottom">
</td>
<td align="right">
<div align="right">
<?php if($admin_href || $write_href){ ?>
<?php if($admin_href) echo "<img name=\"admin\" alt=\"관리자\" src=\"{$board_skin_path}/img/btn_admin.gif\" style='cursor:hand' onclick=\"window.document.location.href='{$admin_href}';\" />"; ?>
<?//php if($write_href) echo "<input type=\"button\" name=\"write\" value=\"회의실 예약\" class=\"button\" onclick=\"open_dialog();\" />"; ?>
<?php if($write_href) echo "<img name=\"reg\" alt=\"회의실 예약\" src=\"{$board_skin_path}/img/reg.gif\" style='cursor:hand' onclick=\"open_dialog();\" />"; ?>
<?php } ?>
</div>
</td>
</tr>
</table><? } ?> 처리끝 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbline1">
<tr>
<td align=center colspan=7 height=40>
<div>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('-1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_prev_month.gif" alt="이전달" border=0 /></a>
<span class="day4"><?php echo date('Y', $VAR['timestamp']); ?></span><span class="day5">년</span>
<span class="day4"><?php echo date('n', $VAR['timestamp']); ?></span><span class="day5">월</span>
<a href="<?php echo phpself('schedule_ym', date('Ym', strtotime('+1 month', $VAR['timestamp']))); ?>"><img src="<?php echo $board_skin_path; ?>/img/b_next_month.gif" alt="다음달" border=0 /></a>
</div>
</td>
</tr>
<tr>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">일</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">월</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">화</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">수</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">목</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">금</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">토</td>
</tr>
<tr>
<?php
for($i = $row = 1; $i < $VAR['count']; $i++, $row++)
{
$date = $i - $VAR['weekday'];
if($date < 1) echo '<td class="tbline2" bgcolor=#F9F9F9> </td>';
else
{
$wr_1 = $VAR['select'] . sprintf('%02d', $date);
$schedule = null;
// 현재날짜로 끝
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 <> '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:left;\"><img src='img/1.png' align=absmiddle width=13> <a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid');\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_subject']} ~{$result['wr_4']}</a></div>";
}
// 당일꺼 뽑아내기
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ORDER BY wr_2 ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$result['wr_content']}</font></div>";
}
// 현재날짜부터 시작
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 <> '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:right;\"><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_2']}~ {$result['wr_subject']}</a> <img src='img/1.png' align=absmiddle width=13></div>";
}
// 기간 사이
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 < '{$wr_1}' AND wr_3 > '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule' style=\"text-align:center;\"><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'1');\" onMouseOut=\"highlight(this,'0');\">{$result['wr_subject']}</a> <img src='img/1.png' align=absmiddle width=12></div>";
}
========================================================================================
표현되는곳이 // 당일꺼 뽑아내기 에서
{$result['wr_content']} 입니다.... 부디 아시는분들 꼭좀 도와주세요... 부탁드립니다.
mickey1377 12-01-19 11:12
$result['wr_content'] << 이게 식사를 구분하는 1 ,0 이라면
if($result['wr_content'] == '1'){
echo "식사"
}else{
echo "식사안함"
}
이렇게 하면 되지 않나요?
=========================================================================================
herius 12-01-19 13:50
위와 같이 하면 오류가 발생하네요.. ㅜ.ㅠ; 어떻게 하면 좋죠... .ㅜ.ㅠ;
==================================================================================
뽁스 12-01-19 14:14
위의 답변에서
echo "식사";
}else{
echo "식사안함";
}
로 해야됩니다.
echo "식사" 뒤에 ; 이 빠졌어요
----------------------------------------------------------------------------------
위에서 가르켜 주신대로 이 부분에 넣으니깐.. 계속 에러가 나네요.. 초보라서요... 꼭좀 알려주세요.
-------------------------------------------------------------------------------------------
// 당일꺼 뽑아내기
$query = sql_query("SELECT * FROM {$write_table} WHERE wr_1 = '{$wr_1}' AND wr_3 = '{$wr_1}' AND ca_name = '{$room_arr[$room]}' ORDER BY wr_2 ");
while($result = mysql_fetch_array($query))
{
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$result['wr_content']}</font></div>";
}
댓글 전체

프로그램을 모르신다는데..위의 프로그램은 다른분이 하신건가보죠..
$result['wr_content'] 부분을 저장된 숫자를 문자로 하려면요..
// 당일꺼뽑아내기 의 while($result = mysql_fetch_array($query)) {
아래에 $meal 이라고 변수를 하나 만들어 아래와 같이 하고..
if($result[wr_content]==1) {
$meal = "식사";
} else {
$meal = "식사안함";
}
$result[wr_content] 부분을 $meal 로 바꾸면 되겠죠..
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$meal}</font></div>";
}
$result['wr_content'] 부분을 저장된 숫자를 문자로 하려면요..
// 당일꺼뽑아내기 의 while($result = mysql_fetch_array($query)) {
아래에 $meal 이라고 변수를 하나 만들어 아래와 같이 하고..
if($result[wr_content]==1) {
$meal = "식사";
} else {
$meal = "식사안함";
}
$result[wr_content] 부분을 $meal 로 바꾸면 되겠죠..
$schedule .= "<div class='schedule'><a href=\"{$VAR['path']}&wr_id={$result['wr_id']}&mode=layer\"
onClick=\"return show_hide_box(this,370,205,'1px solid')\" onMouseOver=\"highlight(this,'2');\" onMouseOut=\"highlight(this,'0');\"><b>{$result['wr_9']}</b> {$result['wr_4']}</a> <font color=red><b>{$result['wr_6']}</b></font> <font color=blue>{$meal}</font></div>";
}
아... 매직크레용님 너무 감사합니다.....
덕분에.. 해결되었습니다~~ ^^
새해복 많이 받으시구요.... 수고하세요.
덕분에.. 해결되었습니다~~ ^^
새해복 많이 받으시구요.... 수고하세요.