아무런 신고기록이 없으면 목록에 아무것도 안나옵니다.
아무런 신고자가 없을때 아래의 메세지를 띄우고 싶습니다.
echo "<tr><td colspan=6 align=center height=100>구속중인 회원이 없습니다.</td></tr>";
제가 완전 초보라서 그러는데 어떻게 수정을 해야 할까요?
Copy
<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']); $stime2 = date("Y-m-d H:i:s", strtotime($Amb_4[$ii][0]) + (int)(60*60*$Amb_4[$ii][2]*2)); // 뒤의 숫자 *2을 자신의 원하는 시간에 맞게 변경 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>"; $ii++;}?><tbody></table>
|
답변 3개 / 댓글 2개
채택된 답변
+20 포인트
2016-05-16 (월) 10:50:41
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개
2016-05-16 (월) 10:47:47
<? |
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; |
26 | while($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 | |
2016-05-15 (일) 09:26:49
아래 내용을 응용해보시면 될 것 같습니다.
Copy
<?php if($row2){?> // 값 있을 때 출력할 내용 <? }else {?> // 값 없을 때 출력할 내용 <? } ?>
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.