我如何在两列和5行中显示此sql数据

时间:2018-11-24 21:56:38

标签: php css sql

我创建了以下代码,它从我的SQL数据库输出。它创建10行和1列,我正在尝试编辑代码,以便将相同的10个结果输出到2列而不是1列?

<div id="tablecontainer">
        <table id="newstable">
        <?
            $query = "SELECT item, link, datestamp, thumb, summary, date FROM news where ((outdoor ='1' and view ='1')) order by datestamp desc limit 10";

                if (ExecuteQuery($linkdb, $result, $query)) {
                    while ($row = NextRow($result)) {

                if (is_null($row[3]))
                {
                  $thumb = 'images/news.jpg';
                }
                else
                {
                  $thumb = 'images/'.$row[3];
                }

                        print('



                <tr class="newstablerow"  valign="top">
                <td colspan="2" class="newstableitem headline" valign="top"><a class="nounderline" href="'.$row[1].'"><h4 id="newsheadline">'.$row[0].'</h4></a><a class="newssummary"<p>'.$row[4].'</p></a>

                <td class="newstableitem newsdate" valign="top"><a class="newstableshortdate" href="'.$row[1].'">'.$row[5].'</a></td></tr>

               ');

                    }
                }

        ?>
        </table>
        </div>

0 个答案:

没有答案