如何在两个列中显示查询数据


How to display query data in two coloumns?

$query = $this->db->get("table_name");
foreach ($query->result() $row)
{
    echo $row->data;
}

它显示的数据像1234我需要像两个列1234

试试这个:

$nm = 0;
$str = '';
$query = $this->db->get("table_name");
foreach ($query->result() $row)
{
   $nm++;
   $str .= $row->data;
   if($nm%2==0){
    echo $str;
    $str = '';
   }
}