| |
  |
$sql = "select * from ad_board where b_table='notice' order by b_idx desc limit 4";
$result = mysql_query($sql,$db);
$record = mysql_num_rows($result);
if($record=="0"){
?>
| 준비중입니다!! |
}else{
$i=0;
while($rows=mysql_fetch_array($result)){
$idx=$rows[b_idx];
$subject=$rows[b_subject];
$count=$rows[b_count];
$date=$rows[b_date];
$date=substr($date,0,10);
$b_date=str_replace("-",".",$date);
// if (strlen($subject) > 28){ //제목이 50자이상부터 ....으로 출력
// $subject = substr($subject,0,50)."...";
// }
$subject = cutstr($subject,40,"...");
$wdate=$rows[b_date];
$wdate=str_replace(" ","-",$wdate); //날짜형식을 2002-02-02-02-02-02으로 변환
$wdate=str_replace(":","-",$wdate);
$ndate=explode("-",$wdate); //"-"를 기준으로 배열에 저장
$wsecond=mktime($ndate[3],$ndate[4],$ndate[5],$ndate[1],$ndate[2],$ndate[0]); //글쓴날짜를 초로환산
$tsecond=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));//현재시간까지를 초로 환산
//현재시간까지의 초(second)에서 글쓴 날짜를 초()로 변화하여 시간차를 구함
$datdiff=$tsecond-$wsecond;
$wdate=$ndate[0]."-".$ndate[1]."-".$ndate[2]; //글쓴날짜만
$today=24*60*60; //하루 24시간을 초로 환산
if ((int)$today > (int)$datdiff){ //글쓴날짜가 하루가 지나지 않으면 새로운글 표시
$new=" ";
}else{
$new="";
}
if ($i%2) {
$color4="#FFFFFF";
}else{
$color4="#FFFFFF";
}
$num = $record - ($listsize*($offset-1))-($i); //가상번호로 순차적인 번호
?>
| [= $b_date?>] = $subject?> |
$i=$i+1;
}
}
?>
|
 |
|
|
|