반복테이블을 2행으로 보이게 하려면 소스를 어떻게 바꿔야 할까요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

반복테이블을 2행으로 보이게 하려면 소스를 어떻게 바꿔야 할까요? 정보

반복테이블을 2행으로 보이게 하려면 소스를 어떻게 바꿔야 할까요?

본문

<?
unset($searchWhere);

$where_  = " code !='".nowSaleItem('01')."' and ";
$where_ .= " code !='".nowSaleItem('02')."' and ";
$where_ .= " code !='".nowSaleItem('03')."' and ";
$where_ .= " code !='".nowSaleItem('04')."' and ";
$where_ .= " code !='".nowSaleItem('05')."' and ";


if($oldSearchWord) $searchWhere[] = " name like '%".$oldSearchWord."%' and ";

if($viewCategory) $searchWhere[] = " cateCode = '".$cateDefineArray2[$viewCategory]."'  and ";

$que = "select * from snsProduct where  ".$where_." ".@implode("",$searchWhere)." sale_date < '".date('Y-m-d')."' and seeDisabled != '1' and code = parent_code and sale_date like '".$thisMonth."%' order by sale_date desc";

$res = mysql_query($que);

if(!mysql_num_rows($res)) {
?>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td height=30 align=center>검색 결과가 없습니다.</td>
  </tr>
 </table>

<?
}


while($row = mysql_fetch_array($res)) {
    $row[name] = $oldSearchWord ? str_replace($oldSearchWord,"<span style='color:blue;background:yellow'>".$oldSearchWord."</span>",$row[name]) : $row[name];   
?>

<!-- 루프 -->
                                                 
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>                               
  <td>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><?=date('Y. m. d',strtotime($row[sale_date])) ?><?=$row[name]=></td>
    </tr>
    </table>

  </td>
  </tr>
</table> 
 
<?
}
?>
<!-- 루프 끝 -->


위의 소스를 ftp에 넣고 확인을 해보면
날짜이름
날짜이름
날짜이름
.
.
.
이런식으로 1행으로 출력이 됩니다.
이것을 2행으로 출력이 되게 고치려면 어떻게 해야할까요?

날짜이름    날짜이름
날짜이름    날짜이름
날짜이름    날짜이름
.
.

이런식으로 보이게 하고싶은데 ㅜ.ㅜ
아무리 해봐도 제대로 안보이네요 ;;
조언을 부탁드립니다 ^ ^
  • 복사

댓글 전체

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
if(!mysql_num_rows($res)) {
?>
 
  <td height=30 align=center>검색 결과가 없습니다.</td>


<?
} else {


for($i = 0 ; $row = mysql_fetch_array($res); $i++ ) {
    $row[name] = $oldSearchWord ? str_replace($oldSearchWord,"<span style='color:blue;background:yellow'>".$oldSearchWord."</span>",$row[name]) : $row[name];   
?>
<? if($i !=0 && $i/2 == 0) { ?>
</tr><tr>
<? } ?>
<!-- 루프 -->
                                                 
                         
  <td>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><?=date('Y. m. d',strtotime($row[sale_date])) ?><?=$row[name]=></td>
    </tr>
    </table>

  </td>

<?
} }
?>

  </tr>
</table> 
 
<!-- 루프 끝 -->
타이핑님 감사합니다 : )
적용을 해보았는데
날짜이름
날짜이름
날짜이름
.
.
이런식으로 출력되던것이 알려주신 소스를 적용하면
날짜이름  날짜이름  날짜이름 . . . .    이런식으로 가로로 배열이 되네요 ㅜ.ㅜ
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<? for($i = 0; $row = mysql_fetch_array($res); $i++) { ?>
<td><?=date('Y. m. d',strtotime($row[sale_date])) ?><?=$row[name]?></td>
<? if (($i + 1) % 2 == 0) echo "</tr><tr>"; ?>
<? } ?>
</tr>
</table>
OH플 님 감사합니다 : )
바로 적용을 해보았습니다.
근데 원래 현재까지 등록되어있던 검색값 4개가 나와야하는데
총 3개가 검색이 되요
이건 왜이럴까요?
© SIRSOFT
현재 페이지 제일 처음으로