회원정보 여분필드 값 조건문으로 불러오기 하려는데

회원정보 여분필드 값 조건문으로 불러오기 하려는데

QA

회원정보 여분필드 값 조건문으로 불러오기 하려는데

본문

<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


 
<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]);
 
  $mb = get_member($list[$i]['mb_id']);

 
    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($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>
 
    <? } ?>

 
       
 
HEREDOC;
 
}
 
?>

 

핑크빈님 댓글 감사합니다
하지만 적어주신 코드를 적용해 보았는데 $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>

이 테이블은 여전히 출력됩니다...

<table border="0" cellspacing="0" cellpadding="0">
 
                    <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
}
 
?>
이렇게 해보실레요

답변을 작성하시기 전에 로그인 해주세요.
전체 0 | RSS
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

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