php读取mysql数据库表的前20条记录,然后分两行显示,每行10条记录,怎么编?

有实例最好,多谢!

$result    = mysql_query('select * from mytable limit 0, 20');
$i       = 0;
while ($rs = mysql_fetch_array($result))
{
    echo $rs['myfield'].' ';
    $i++;
    if ($i == 10)
    {
        echo '<br />';
    }
}

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答