테스트 사이트 - 개발 중인 베타 버전입니다

게시글이 없을때 게시글이 없다고 표시하고 싶습니다. 채택완료

미니니 9년 전 조회 1,760

아무런 신고기록이 없으면 목록에 아무것도 안나옵니다.

아무런 신고자가 없을때 아래의 메세지를 띄우고 싶습니다.

echo "<tr><td colspan=6 align=center height=100>구속중인 회원이 없습니다.</td></tr>";

제가 완전 초보라서 그러는데 어떻게 수정을 해야 할까요?

 

 

<table cellspacing="0" border="1" summary="<?=$g4[title]?>" class="tbl_list">
<caption><?=$g4[title]?></caption>
<colgroup>
<col width="20%">
<col width="10%">
<col>
<col>
<col width="15%">
<col width="15%">
</colgroup>
<thead>
<tr>
  <th scope="col"><span class="title">피고인</span></th>
  <th scope="col"><span class="title">횟수</span></th>
  <th scope="col"><span class="title">구속일</span></th>
  <th scope="col"><span class="title">출소일</span></th>
  <th scope="col"><span class="title">죄목</span></th>
  <th scope="col"><span class="title last">신고자</span></th>
</tr>
</thead>
<tbody>
<?
$sql2 = 'SELECT mb_id,mb_4 FROM g4_member WHERE mb_4 <> \'\' ORDER BY `mb_4` DESC '; 
$result2 = sql_query($sql2); 
$ii=1;
while($row2 = sql_fetch_array($result2)){
    $snick2[$ii] = $row2['mb_id'];
    $Amb_4[$ii] = explode("|",$row2['mb_4']);</p><p>    $stime2 = date("Y-m-d H:i:s", strtotime($Amb_4[$ii][0]) + (int)(60*60*$Amb_4[$ii][2]*2)); // 뒤의 숫자 *2을 자신의 원하는 시간에 맞게 변경</p><p>    echo "<tr><td>".$snick2[$ii]."</td><td>".$Amb_4[$ii][2]."</td><td>".$Amb_4[$ii][0]."</td><td>".$stime2."</td><td>".$Amb_4[$ii][3]."</td>";
    if($member['mb_level']>=101) echo "<td>".$Amb_4[$ii][1]."</td>"; // 레벨이 101 이상만 신고자의 이름이 보입니다.
    else echo"<td>비공개</td>";
    echo "</tr>";</p><p>    $ii++;
}
?>
<tbody>
</table>
 

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트
9년 전

 

30    echo "<tr><td>".$snick2[$ii]."</td><td>".$Amb_4[$ii][2]."</td><td>".$Amb_4[$ii][0]."</td><td>".$stime2."</td><td>".$Amb_4[$ii][3]."</td>";
31    if($member['mb_level']>=101) echo "<td>".$Amb_4[$ii][1]."</td>"// 레벨이 101 이상만 신고자의 이름이 보입니다.
32    else echo"<td>비공개</td>";
33    echo "</tr>";
34    $ii++;

 

}else{

//없을때

}

35}
36?>

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

미니니
9년 전
감사합니다. 잘되네요 ㅎㅎ

댓글을 작성하려면 로그인이 필요합니다.

9년 전

 

<?
23$sql2 'SELECT mb_id,mb_4 FROM g4_member WHERE mb_4 <> \'\' ORDER BY `mb_4` DESC ';
24$result2 = sql_query($sql2);
25$ii=1;
26while($row2 = sql_fetch_array($result2)){

 

if($row2){//있을때

27    $snick2[$ii] = $row2['mb_id'];
28    $Amb_4[$ii] = explode("|",$row2['mb_4']);
29    $stime2 date("Y-m-d H:i:s"strtotime($Amb_4[$ii][0]) + (int)(60*60*$Amb_4[$ii][2]*2)); // 뒤의 숫자 *2을 자신의 원하는 시간에 맞게 변경
30    
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

N
9년 전

아래 내용을 응용해보시면 될 것 같습니다.

 

<?php if($row2){?></p><p> </p><p>// 값 있을 때 출력할 내용</p><p> </p><p><? }else {?></p><p> </p><p>// 값 없을 때 출력할 내용</p><p> </p><p><? } ?>

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

미니니
9년 전
제가 초보라 ㅠ 해봤는데 오류가 ㅠ

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인

© 2025 SIRSOFT. All rights reserved.