如何获取带有两个列的连续数组?

时间:2019-11-03 11:20:25

标签: php html bootstrap-4

我正在使用mysqli_fetch_array提取100行,并放入col-md-6。

但是如何在50行之后触发换行,以便有两个col-md-6以获得更好的视图?

  this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {
      Linking.openURL('https://www.google.com/');
  });

  /*
  * If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
  * */
  const notificationOpen = await firebase.notifications().getInitialNotification();
  if (notificationOpen) {
      Linking.openURL('https://www.google.com/');
  }

1 个答案:

答案 0 :(得分:2)

只需使用一个计数器即可。

<div class="row">
    <div class="col-md-6">
       <?php
         $i = 1; 
         while($row = mysqli_fetch_array($sql)) {
            echo '<input type="checkbox">', $row['name'], '</input>';
            if($i++ == 50) echo '</div>', PHP_EOL, '<div class="col-md-6">', PHP_EOL;
         }
       ?>
    </div>
</div>
  

注意:$row['name']必须在回声引号中打印出来。