php table: display 3 cells in each row

前端 未结 3 1623
我在风中等你
我在风中等你 2021-01-26 18:02

I looked here: Array into a table with 5 cells in each row

but I cannot adapt my code..

I need to display PHP array results in a table. The table needs to have 3

3条回答
  •  深忆病人
    2021-01-26 18:47

    Try this

    echo "";
    $num=mysql_numrows($result1);
    $i=0;
    
    while ($i < $num)
    {
      $aaa=mysql_result   ($result1,$i,"aaa");
      $bbb=mysql_result   ($result1,$i,"bbb");
      if($i %3 ==0)
      {
         echo"";  
      }
      else
      {
        echo"";  
      }
      $i++;
    }
    echo "
    $aaa $bbb $aaa $bbb
    ";

提交回复
热议问题