เรื่อง ตาราง TABLE แสดงแถวละ 6รายการทำยังไงดีครับ

เริ่มโดย HowAreU, 10 มิถุนายน 2017, 18:03:37

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

HowAreU

อยากให้แสดงข้อมูลจากตาราง ประมาณนี้ครับ สมมุตมีทั้งหมด 12record  พอครบ 6 record ให้แสดงต่อแถวใหม่ครับ




นี้โค้ดที่ลองทำครับ คือมันจะต่อ 1 2 3 4 5 6 7 8 9 10 11 12.... ไปเรื่อยๆในแถวเดียวจนครบ record
อยากให้แสดงผลตามรูปข้างบนต้องเขียนโค้ดยังไงดีครับ  :wanwan006:



         <table class="tg" width="100%">
                    <tr>
                        <th style="width: 17%"  class="tg-031e"></th>
                        <th style="width: 17%" class="tg-yw4l"></th>
                        <th style="width: 17%" class="tg-yw4l"></th>
                        <th style="width: 17%"  class="tg-yw4l"></th>
                        <th style="width: 17%" class="tg-yw4l"></th>
                        <th style="width: 17%" class="tg-yw4l"></th>
                    </tr>

                    <tr>

                        <?php
                        while ( 
$result mysqli_fetch_array($CHRow ) ) {
                        ?>

                        <td class="tg-yw4l">
                            <div class="box">   
                                <h4 class="title"><?php echo $result['cat_name']  ?></h4>
                            </div>
                        </td>
                        <?php
                        }
?>


                    </tr>



                </table>

darkonwrite

ลองใช้ assoc ทำครับ ผมก็จำไม่ค่อยได้ เป็น php

HowAreU