2012-02-22 7 views
1

아래 표에서 페이지 매기기가 아닌 결과 표를 만들고 싶습니다.테이블이 아닌 표 만들기

그래서 나는 10 개의 결과 세트를 반향 출력하고, 그 다음 200 픽셀 오른쪽으로 계속 진행합니다. 그런 다음 10 개의 결과가 더 나오면 200 픽셀 오른쪽에서 계속합니다.

어떻게하면됩니까?

$query2 = "SELECT street1, city, state, zip, phone, website 
FROM addresses 
WHERE submissionid=$submissionid 
ORDER BY street1 DESC";  


$result2 = mysql_query($query2); 

$arr2 = array(); 

    echo "<table class=\"commentecho3\">"; 


    while ($row2 = mysql_fetch_array($result2)) { 

     echo '<tr>'; 
     echo '<td>'.strtoupper($row2["street1"]).'</td>'; 
     echo '</tr>'; 

     echo '<tr>'; 
     echo '<td>'.strtoupper($row2["city"]).', &nbsp;'.strtoupper($row2["state"]).'&nbsp;&nbsp;'.strtoupper($row2["zip"]).'</td>'; 
     echo '</tr>'; 

     echo '<tr>'; 
     echo '<td>'.strtoupper($row2["phone"]).'</td>'; 
     echo '</tr>'; 

     echo '<tr>'; 
     echo '<td>'.strtoupper($row2["website"]).'</td>'; 
     echo '</tr>'; 

     echo '<tr>'; 
     echo '<td></td>'; 
     echo '</tr>'; 

     echo '<tr>'; 
     echo '<td></td>'; 
     echo '</tr>'; 

    } 
    echo "</table>"; 
+0

이 경우 CSS를 사용해야합니다. 필요에 따라 float 속성을 사용하여 정렬하십시오. – dee

답변

0

실제로 테이블을 사용해야합니까? {플로트 : 왼쪽; 패딩 - 오른쪽 : 200 픽셀;} CSS를 .foo의 클래스를 만듭니다 Webgal 제안처럼, 정말 쉽게 떠있는 div를 사용하여 수행 할 수

업데이트 PHP (이것은 다른 방법을 수행 할 수 있습니다) :

$i=0; 
echo('<div class="foo">'); 
while ($row2 = mysql_fetch_array($result2)) { 
echo '<p>'.strtoupper($row2["street1"]).'</p>'; 
    ................................. 
$i++; 
if ($i=10){ 
    echo('</div><div class="foo">'); 
} 
} 
echo('</div>'); 
관련 문제