if 문 급하게 질문 드립니다. 정보
if 문 급하게 질문 드립니다.본문
for ($i=0; $i<$op4[$number]; $i++) {
if ($i%$array==0) echo "</tr><tr>";
echo "<td align='center' valign='middle' height='$op3[$number]' width='$op2[$number]'>";
$line_height = $op3[$number]*4;
<!--첫번째-->
if ($file[$i][bf_file]) {
if (preg_match("/(banner1\.gif)$/i", $file[$i][bf_file])) {
echo "<table width=254 height=103 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/data/file/$banner_board/{$file[$i][bf_file]}>
<tr>
<td>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong>
<font color='#F41368'>{$list[$i][wr_subject]}</font></strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#BFBFBF> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong><font color=#BFBFBF>TEL</strong> : <strong>{$list[$i][wr_8]}</font> </strong></div>
</td>
</tr>
</table>
</td>
</tr>
</table>";
}
여기까지 첨부파일이 존재하고 banner1.gif이라면 위 내용을 출력하라
<!--두번째-->
if (preg_match("/(banner2\.gif)$/i", $file[$i][bf_file])) {
echo "<table width=254 height=103 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/data/file/$banner_board/{$file[$i][bf_file]}>
<tr>
<td>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong>
<font color='#000000'>{$list[$i][wr_subject]}</font></font></strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#8B8857> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong><font color=#8B8857>TEL</strong> : <strong>{$list[$i][wr_8]}</font> </strong></div>
</td>
</tr>
</table>
</td>
</tr>
</table>";
}
<여기까지 첨부파일이 존재하고 banner2.gif이라면 위 내용을 출력하라 >
<!--세번째-->
elseif(empty($file[$i]['bf_file'])) {
echo "<table width=200 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/img/bbbg.gif>
<tr>
<td><img src=$g4[path]/img/bbtop.gif width=252 height=18></td>
</tr>
<tr>
<td height=55 valign=top>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong><font color=#FF6600>
{$list[$i][wr_subject]}</strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#000000> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong>TEL</strong> : <strong>{$list[$i][wr_8]} </strong></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src=$g4[path]/img/bbbottom.gif width=252 height=18></td>
</tr>
</table>";
}
<!--첨부파일이 없다면 위 내용을 출력하라 -->
<!--네번째-->
}else {
echo "<a style='cursor:pointer; border:0px solid #999999; width:$op2[$number]; height:$op3[$number]; padding:$paddings 0 0 0;' onclick=\"window.open('$g4[path]/bbs/write.php?bo_table=$banner_board','배너등록','width=600, height=600, scrollbars=1')\">$memo</a>";
}
echo "</td>";
}
echo "</tr></table>";
}
?>
<!--글이 존재하지 않으면 위 내용을 출력하라 -->
첫번째, 두번째 경우까지는 정상적을 출력이 됩니다.
그런데 세번째 경우에는 배너 없이 제목과, 내용은 출력이 되야 하는데 바로 else에 있는 내용"배너를 등록해 주세요" 가 출력 되어 버립니다.
조건문 이제 막 시작한 초보라 너무 어렵고 눈이 안보일 지경입니다.
..ㅜ ㅜ좀 도와 주십시오.
if ($i%$array==0) echo "</tr><tr>";
echo "<td align='center' valign='middle' height='$op3[$number]' width='$op2[$number]'>";
$line_height = $op3[$number]*4;
<!--첫번째-->
if ($file[$i][bf_file]) {
if (preg_match("/(banner1\.gif)$/i", $file[$i][bf_file])) {
echo "<table width=254 height=103 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/data/file/$banner_board/{$file[$i][bf_file]}>
<tr>
<td>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong>
<font color='#F41368'>{$list[$i][wr_subject]}</font></strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#BFBFBF> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong><font color=#BFBFBF>TEL</strong> : <strong>{$list[$i][wr_8]}</font> </strong></div>
</td>
</tr>
</table>
</td>
</tr>
</table>";
}
여기까지 첨부파일이 존재하고 banner1.gif이라면 위 내용을 출력하라
<!--두번째-->
if (preg_match("/(banner2\.gif)$/i", $file[$i][bf_file])) {
echo "<table width=254 height=103 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/data/file/$banner_board/{$file[$i][bf_file]}>
<tr>
<td>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong>
<font color='#000000'>{$list[$i][wr_subject]}</font></font></strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#8B8857> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong><font color=#8B8857>TEL</strong> : <strong>{$list[$i][wr_8]}</font> </strong></div>
</td>
</tr>
</table>
</td>
</tr>
</table>";
}
<여기까지 첨부파일이 존재하고 banner2.gif이라면 위 내용을 출력하라 >
<!--세번째-->
elseif(empty($file[$i]['bf_file'])) {
echo "<table width=200 border=0 cellpadding=0 cellspacing=0 background=$g4[path]/img/bbbg.gif>
<tr>
<td><img src=$g4[path]/img/bbtop.gif width=252 height=18></td>
</tr>
<tr>
<td height=55 valign=top>
<table width=240 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=30>
<div align=center><strong><font color=#FF6600>
{$list[$i][wr_subject]}</strong></div>
</td>
</tr>
<tr>
<td height=25>
<div align=center><strong><font color=#000000> {$list[$i][wr_4]} </strong></div>
</td>
</tr>
<tr>
<td>
<div align= center><strong>TEL</strong> : <strong>{$list[$i][wr_8]} </strong></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src=$g4[path]/img/bbbottom.gif width=252 height=18></td>
</tr>
</table>";
}
<!--첨부파일이 없다면 위 내용을 출력하라 -->
<!--네번째-->
}else {
echo "<a style='cursor:pointer; border:0px solid #999999; width:$op2[$number]; height:$op3[$number]; padding:$paddings 0 0 0;' onclick=\"window.open('$g4[path]/bbs/write.php?bo_table=$banner_board','배너등록','width=600, height=600, scrollbars=1')\">$memo</a>";
}
echo "</td>";
}
echo "</tr></table>";
}
?>
<!--글이 존재하지 않으면 위 내용을 출력하라 -->
첫번째, 두번째 경우까지는 정상적을 출력이 됩니다.
그런데 세번째 경우에는 배너 없이 제목과, 내용은 출력이 되야 하는데 바로 else에 있는 내용"배너를 등록해 주세요" 가 출력 되어 버립니다.
조건문 이제 막 시작한 초보라 너무 어렵고 눈이 안보일 지경입니다.
..ㅜ ㅜ좀 도와 주십시오.
댓글 전체
위코드대로라면 당연히 3번째는 무시됩니다.
파일이 없는경우에 한해 글에대한 확인을 해줘야 겠지요.
그런다음 4번째가 되어야 하고..
<!--세번째-->
// 파일은 없고, 글자료는 있고
else if($list[$i]['wr_subject'] != '' && empty($file[$i]['bf_file'])) {
}
// 글자료가 없는경우(글자료가 없으니 파일은 당연히 없고)
else
{
기타작업
echo "배너등록";
}
* 질문시에 '급합니다' '빨리도와주세요' '빨리답변바랍니다' ... 등과 같은 말머리는 사용하지 마십시오. 답변자들이 답변하려고 대기하고 있는건 아니니..
파일이 없는경우에 한해 글에대한 확인을 해줘야 겠지요.
그런다음 4번째가 되어야 하고..
<!--세번째-->
// 파일은 없고, 글자료는 있고
else if($list[$i]['wr_subject'] != '' && empty($file[$i]['bf_file'])) {
}
// 글자료가 없는경우(글자료가 없으니 파일은 당연히 없고)
else
{
기타작업
echo "배너등록";
}
* 질문시에 '급합니다' '빨리도와주세요' '빨리답변바랍니다' ... 등과 같은 말머리는 사용하지 마십시오. 답변자들이 답변하려고 대기하고 있는건 아니니..
너무 감사합니다.
드디어 되네요!
정말 온종일 쳐다보느라 눈이 빠질 지경이었는데..
공부 열심히 해야 겠습니다.
정말 감사합니다.
덕분에 하루 마무리가 잘 되었습니다.
꾸벅~
드디어 되네요!
정말 온종일 쳐다보느라 눈이 빠질 지경이었는데..
공부 열심히 해야 겠습니다.
정말 감사합니다.
덕분에 하루 마무리가 잘 되었습니다.
꾸벅~