채택완료

쪽지관련 문의드립니다.

2015-10-11 (일) 21:34:01 2,468

비회원도 쪽지를 보낼 수 있도록 했습니다.(비회원이 쪽지발송시 보낸사람은 공란으로 나옴) 

memo.skin.php 에서 받은 쪽지 확인시 '보낸사람 필드가 비어있다면' 이라는 if문을 만들려고

이것저것 해보는데 잘 안되네요.  

아래 내용에서 <?php echo $list[$i]['name'] ?> 이부분에 조건을 넣으려고 합니다.

Copy
<div class="btn-group btn-group-justified">    <a href="./memo.php?kind=recv" class="btn btn-sm btn-black<?php echo ($kind == "recv") ? ' active' : '';?>">받은쪽지</a>    <a href="./memo.php?kind=send" class="btn btn-sm btn-black<?php echo ($kind == "send") ? ' active' : '';?>">보낸쪽지</a>    <a href="./memo_form.php" class="btn btn-sm btn-black<?php echo ($kind == "") ? ' active' : '';?>">쪽지쓰기</a></div><table class="div-table table"><tbody><tr class="active">    <th class="text-center" scope="col">번호</th>    <th class="text-center" scope="col"><?php echo  ($kind == "recv") ? "보낸사람" : "받는사람";  ?></th>    <th class="text-center" scope="col">보낸시간</th>    <th class="text-center" scope="col">읽은시간</th>    <th class="text-center" scope="col">관리</th></tr><?php for ($i=0; $i<count($list); $i++) {  ?>    <tr>        <td class="text-center"><?php echo $list[$i]['num'] ?></td>        <td><b><?php echo $list[$i]['name'] ?></b></td>        <td class="text-center"><a href="<?php echo $list[$i]['view_href'] ?>"><?php echo $list[$i]['send_datetime'] ?></a></td>        <td class="text-center"><a href="<?php echo $list[$i]['view_href'] ?>"><?php echo $list[$i]['read_datetime'] ?></a></td>        <td class="text-center"><a href="<?php echo $list[$i]['del_href'] ?>" onclick="del(this.href); return false;">삭제</a></td>    </tr><?php } ?>
 
|

답변 1개 / 댓글 2개

채택된 답변
+20 포인트

<?php echo $list[$i]['name'] ? $list[$i]['name'] : '비어있음'; ?>

답변에 대한 댓글 2개

답변 감사합니다.
근데 여전히 공란으로 나옵니다. ㅠㅠ
감사합니다. 아래처럼 해결했습니다.
<?php echo $list[$i]['mb_id'] ? $list[$i]['name'] : '비어있음'; ?>

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