Creating a dynamic table with PHP

后端 未结 2 494
南笙
南笙 2020-12-09 23:50

I\'m trying to make a dynamic table with PHP. I have a page which displays all the pictures from a database. I need the table to be of 5 columns only. If more than 5 pictur

2条回答
  •  借酒劲吻你
    2020-12-09 23:57

    $max_per_row = 5;
    $item_count = 0;
    
    echo "";
    echo "";
    foreach ($images as $image)
    {
        if ($item_count == $max_per_row)
        {
            echo "";
            $item_count = 0;
        }
        echo "";
        $item_count++;
    }
    echo "";
    echo "
    ";

提交回复
热议问题