0

mysql の結果を同じ行数の 5 div に表示する方法を探しています。

ここで私がしたこと:

$query_1 = $mysqli->query("SELECT * FROM tables ORDER BY id ASC");
$all_cnt = array();
$i = 0;
while($rows = mysqli_fetch_assoc($query_1)) {
    $all_cnt[$i] = $rows["name"];
    $i++;
}

$all_cnt = array_chunk($all_cnt, 5);
$output = "";

foreach($all_cnt as $cnt) {
    $output .= '
            <div class="col-md-2 ">
              <div class="row content">
                <ul class="list-unstyled">
    ';
    foreach ($cnt as $t) {
       $output .= '<li>'.$t.'</li>';
    }
    $output .= '
                </ul>
              </div>
            </div>
    ';


}

しかし、私は順序付けられた結果を取得せず、各グリッドで同じ番号を取得しません!

他の解決策はありますか?

4

0 に答える 0