값이 없을경우엔 출력하지 않도록 하고싶습니다. 정보
값이 없을경우엔 출력하지 않도록 하고싶습니다.본문
지출 란의 출력 소스는
<td valign="top" align="left"><span style='color:#ff0000'>지출 총계 :  <?=number_format($list[$i][wr_2]+$list[$i][wr_4]+$list[$i][wr_6]+$list[$i][wr_8]+$list[$i][wr_10]+$list[$i][wr_12]+$list[$i][wr_14]);?></span>
<br><?=$list[$i][wr_1]?>  <?=number_format($list[$i][wr_2])?>
<br><?=$list[$i][wr_3]?>  <?=number_format($list[$i][wr_4])?>
<br><?=$list[$i][wr_5]?>  <?=number_format($list[$i][wr_6])?>
<br><?=$list[$i][wr_7]?>  <?=number_format($list[$i][wr_8])?>
<br><?=$list[$i][wr_9]?>  <?=number_format($list[$i][wr_10])?>
<br><?=$list[$i][wr_11]?>  <?=number_format($list[$i][wr_12])?>
<br><?=$list[$i][wr_13]?>  <?=number_format($list[$i][wr_14])?>
</td>
이것입니다.
문제는 지출이 없을경우 공란으로 나와야 할텐데
위처럼 0 으로 표시가 되어버립니다 ㅠㅠ
초보에게 한줄기 조언좀 부탁드리겟습니다
<td valign="top" align="left"><span style='color:#ff0000'>지출 총계 :  <?=number_format($list[$i][wr_2]+$list[$i][wr_4]+$list[$i][wr_6]+$list[$i][wr_8]+$list[$i][wr_10]+$list[$i][wr_12]+$list[$i][wr_14]);?></span>
<br><?=$list[$i][wr_1]?>  <?=number_format($list[$i][wr_2])?>
<br><?=$list[$i][wr_3]?>  <?=number_format($list[$i][wr_4])?>
<br><?=$list[$i][wr_5]?>  <?=number_format($list[$i][wr_6])?>
<br><?=$list[$i][wr_7]?>  <?=number_format($list[$i][wr_8])?>
<br><?=$list[$i][wr_9]?>  <?=number_format($list[$i][wr_10])?>
<br><?=$list[$i][wr_11]?>  <?=number_format($list[$i][wr_12])?>
<br><?=$list[$i][wr_13]?>  <?=number_format($list[$i][wr_14])?>
</td>
이것입니다.
문제는 지출이 없을경우 공란으로 나와야 할텐데
위처럼 0 으로 표시가 되어버립니다 ㅠㅠ
초보에게 한줄기 조언좀 부탁드리겟습니다
댓글 전체
각 행의 앞에 조건문을 넣어주세요.
즉
<br><?php if($list[$i][wr_1] != '') echo "number_format($list[$i][wr_1])"; ?>
<br><?php if($list[$i][wr_2] != '') echo "number_format($list[$i][wr_2])"; ?>
이렇게 wr_1 ~ wr_14 까지 바꿔주면서 해주시면 될겁니다.
즉
<br><?php if($list[$i][wr_1] != '') echo "number_format($list[$i][wr_1])"; ?>
<br><?php if($list[$i][wr_2] != '') echo "number_format($list[$i][wr_2])"; ?>
이렇게 wr_1 ~ wr_14 까지 바꿔주면서 해주시면 될겁니다.
무지 간단한거였네요 ㅠㅠ
감사합니다
감사합니다
ㅠㅠ 근데 number_format($ 어찌고 그대로 출력되네요
아무래도 echo 를 쓰는게 아니고 다른걸 써야하나 본데요 ㅠㅠ
아무래도 echo 를 쓰는게 아니고 다른걸 써야하나 본데요 ㅠㅠ