어제 에러 해결했습니다. > 자유게시판

자유게시판

어제 에러 해결했습니다. 정보

어제 에러 해결했습니다.

본문

일단... 소스중에 $list2값이 없었습니다.
제가 다른그룹에 글을 추가하고.... 새로운글이 안뜬다고 하고 잇었네요...
역시 피곤하면 이것저것 동시에 볼수 없나 봅니다.
그리고... $list2값이 없을때 에러를 뿌리지 않게 하기위하여 if(is_array($list2)){를 추가하였습니다. ㅎ.ㅎ;;
아래는 전체 소스입니다.
<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
include_once("./_head.php");
$before_day = "5";
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
 

$top1 = $top2 = 5;
$gr_id = "community";
$sql = " select bo_table, bo_notice from $g4[board_table]
          where gr_id = 'news' and bo_table !='photo' and bo_table !='movie'
            and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
 $sql2 = " select * from $g4[write_prefix]$row[bo_table]
               where wr_comment > -1
                 and wr_datetime >= '{$before_time}' ";

    $result2 = sql_query($sql2);
    while ($row2 = sql_fetch_array($result2))
    {
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
        $list2[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";
    }
}
$list4 = $list2;
@krsort($list2);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
        <tr>
       <td height="25">    
      <div style="float:left"><img src="<?=$g4[path]?>/images/h_popular.gif"></div>
       </td>
     </tr>
  <?
        $i=0;
  if(is_array($list2)){ // $list2 배열이 없을때 에러를 뿌리기에 임시로 에러 뿌리지 않게 설정
        foreach($list2 as $key=>$value) {
            if ($i++>=($top1)) break;
        ?>
        <tr>
       <td><img src="<?=$g4[path]?>/images/txt_num<?=$i?>.gif" hspace="6">
                <?
                echo $list2[$key][icon_reply] . " ";
                echo "<a href='{$list2[$key][href]}'>";
                echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'><b>{$list2[$key][subject]}<!-- ({$list2[$key][wr_hit]}) --></b></font>";
                echo "</a>";
                ?>
            </td>
  </tr>
<?
 $r_i = $i;
 }} ?>
  <?
   $r_num = $before_day - $r_i;
   if($r_i <> ""){
    for ($i=0; $i<$r_num; $i++) {
  ?>
  <tr><td><img src="<?=$g4[path]?>/images/txt_num<?=$i +2?>.gif" hspace="6"> 데이터가 없습니다.</td></tr>
  <? }} ?>
        <? if (count($list2) == 0) { ?>
        <tr><td align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">이번주 랭킹이 존재하지 않습니다.</td></tr>
        <? } ?>
        </table>
<?
include_once("./_tail.php");
?>
추천
0

댓글 2개

전체 199,644 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT