边界位置

时间:2014-06-04 15:04:09

标签: html css html-table

CSS:

table.tftable {
       font-size:12px;
       color:#333333;
       width:50%;
       border-width: 1px;
       border-color: #729ea5;
       border-collapse: collapse;
}
table.tftable th {
       font-size:12px;
       background-color:#acc8cc;
       border-width: 1px;
       padding: 8px;
       border-style: solid;
       border-color: #729ea5;
       text-align:left;
}
table.tftable tr {
       background-color:#d4e3e5;
}
table.tftable td {
       font-size:12px;
       border-width: 1px;
       padding: 8px;
       border-style: solid;
       border-color: #729ea5;
}

PHP:

<?php
  $queryOtherEvents = "select * from `eventos` where `data` > '$data'";
  $resultOtherEvents = mysql_query($queryOtherEvents);

  while($row = mysql_fetch_array($resultOtherEvents)) {
    $nome = $row['nome'];
    $data = $row['data'];
    $url = $row['descricao'];
    echo "<table id=tfhover class=tftable border=1>";
    echo "<tr><th>$data</th><th><a href=$url>$nome</a></th></tr>";
    echo "</table>";
  }
?>

我在表格中显示事件的日期和事件的名称,但如果事件的名称大于1,则边框的位置会切换...,您将如何在下图中看到:

enter image description here

1 个答案:

答案 0 :(得分:0)

我认为您的问题是您为每一行插入一个表。 您应该使用一个表,并为数据库中的每一行添加一行到表。

试试这个

   <?php
      $queryOtherEvents = "select * from `eventos` where `data` > '$data'";
      $resultOtherEvents = mysql_query($queryOtherEvents);
     echo "<table id=tfhover class=tftable border=1>";
      while($row = mysql_fetch_array($resultOtherEvents)) {
        $nome = $row['nome'];
        $data = $row['data'];
        $url = $row['descricao'];

        echo "<tr><th>$data</th><th><a href=$url>$nome</a></th></tr>";

      }
     echo "</table>";

?>