Insert line break after every two rows of database

前端 未结 6 1279
清酒与你
清酒与你 2021-01-16 08:31

I have a little script that prints a certain amount of rows in a mysql database.

Is there any way to make it so that after every second row it prints, ther

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-16 09:33

    You write "script" but in tags you have PHP, so I suppose you need PHP code:

    foreach ($rows as $row) {
        if ($i++ % 2) { 
             // this code will only run for every even row
        }
        ...
    }
    

提交回复
热议问题