회원정보 여분필드 값 조건문으로 불러오기 하려는데 채택완료
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col" class="title_title">광고 및 등록내역</th>
<th scope="col" class="title_date">등록일</th>
</tr>
<?
for ($i=0; $i<count($list); $i++)
{
$gr_subject = $list[$i][gr_subject];
$bo_subject = $list[$i][bo_subject];
$wr_subject = get_text($list[$i][wr_subject]);
echo <<<HEREDOC
<tr>
<td class="title"><a href='/bbs/{$list[$i][href]}'>{$bo_subject}</a></td>
<td class="date">{$list[$i][datetime]}</td>
</tr>
<? if($member[mb_6]) { ?>
<tr>
<td class="title"><a href="$member[mb_3]">$member[mb_1]</a></td>
<td class="date">$member[mb_1]</td>
</tr>
<? } ?>
HEREDOC;
}
?>
이런식으로 코드 작성을 하면 회원정보 여분필드 6번(mb_6)의 값이 기재되어 있을때 나와야 하는거잖아요?
근데 값이 없는데도 <tr>태그의 값이 출력되고 있습니다
제가 조건문 작성을 잘못한건지 봐주시면 감사하겠습니다
답변 1개
광고 및 등록내역
등록일
$mb[mb_1]
$mb[mb_1]
HEREDOC;
}
?>
답변에 대한 댓글 3개
<tr>
<th scope="col" class="title_title">광고 및 등록내역</th>
<th scope="col" class="title_date">등록일</th>
</tr>
<?php
for ($i=0; $i<count($list); $i++)
{
$gr_subject = $list[$i]['gr_subject'];
$bo_subject = $list[$i]['bo_subject'];
$wr_subject = get_text($list[$i]['wr_subject']);
$mb = get_member($list[$i]['mb_id']);
?>
<tr>
<td class="title"><a href='/bbs/<?php echo $list[$i]['href']; ?>'><?php echo $bo_subject; ?></a></td>
<td class="date"><?php echo $list[$i]['datetime']; ?></td>
</tr>
<?php if($mb['mb_6']) { ?>
<tr>
<td class="title"><a href="<?php echo $mb['mb_3']; ?>"><?php echo $mb['mb_1'];?></a></td>
<td class="date"><?php echo $mb['mb_1']; ?></td>
</tr>
<?php } ?>
<?php
}
?>
이렇게 해보실레요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
하지만 적어주신 코드를 적용해 보았는데 $mb[mb_6]의 값이 없는데도
<tr>
<td class="title"><a href="$mb[mb_3]">$mb[mb_1]</a></td>
<td class="date">$mb[mb_1]</td>
</tr>
이 테이블은 여전히 출력됩니다...