<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .wrapper { overflow-x: scroll; width: 50%; } table { table-layout: fixed; width: 100%; border-collapse: collapse; background: white; } tr { border-top: 1px solid #ccc; } td, th { vertical-align: top; text-align: left; width: 150px; padding: 5px; } .fix { position: sticky; background: white; } .fix:first-child { left: 0; width: 180px; } </style> </head> <body> <div class="wrapper"> <table> <thead> <th class='fix'>Fixed</th> <th>Col 1</th> <th>Col 2</th> <th>Col 3</th> <th>Col 4</th> <th>Col 5</th> </thead> <tbody> <tr> <td class='fix'>AAA</td> <td>A1</td> <td>A2</td> <td>A3</td> <td>A4</td> <td>A5</td> </tr> <tr> <td class='fix'>BBB</td> <td>B1</td> <td>B2</td> <td>B3</td> <td>B4</td> <td>B5</td> </tr> <tr> <td class='fix'>CCC</td> <td>C1</td> <td>C2</td> <td>C3</td> <td>C4</td> <td>C5</td> </tr> </tbody> </table> </div> </body> </html>
$fld_col = (object)['name'=>0, 'value'=>1]; // กำหนดตำแหน่ง field แสดงที่บันทัดไหน $new_ar=[]; for($i=0; $i<$จำนวนfield; $i++){ $new_ar[]=[0,0]; // จำนวน element เท่ากับจำนวน เรคคอร์ด; } while( $ro = mysqli_fetch_assoc( $result)){ $i=true; $n=0; foreach($ro as $k=>$v){ $new_ar[$fld_col->{$k}][$n]=$v; $n++; } } print_r($new_ar);
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง