【发布时间】:2018-06-01 23:39:54
【问题描述】:
我的脚本基本上从我的数据库中加载数据,我必须在某个地方 <br> 但它不会工作,因为它是一个巨大的表。所以我需要格式化这个表,这样每 10 行就有一个<br>。
<table align="center" cellspacing="0" cellpadding="0">
<?php
$date = mysql_query("SELECT DISTINCT `date` FROM `matches`");
while($daterow = mysql_fetch_assoc($date)){
echo ' <tr>
<td style="width:60px; background-color:#000000;"><font color="#FFFFFF" style="font-size:11px">'.$daterow['date'].'</font></td>
</tr>
';
$query = mysql_query("SELECT hour, team1, team2, goalsteam1, goalsteam2, competition FROM `matches` WHERE `date`='". $daterow['date'] ."'");
while($row = mysql_fetch_array($query)){
$teamtest = mysql_query("SELECT teamname FROM `teams` WHERE `team`='".$row['team1']."'");
$teamtestrow = mysql_fetch_assoc($teamtest);
$hour = substr($row['hour'],0,5);
echo '
<tr class="teamtable">
<td style="width:60px; font-size:11px;">'.$hour.'</td>
<td style="width:145px; font-size:11px;">'.$teamrow['teamtest'].'</td>
<td style="width:15px; font-size:11px;">'.$row['goalsteam1'].'</td>
<td style="width:15px; font-size:11px;">'.$row['goalsteam2'].'</td>
<td style="width:145px; font-size:11px;">'.$row['team2'].'</td>
<td style="width:120; font-size:11px;">'.$row['competition'].'</td>
</tr>';
}
}
?>
</table>
或者只是在每个日期之前<br>。当我尝试时,它只会留下一个巨大的空白空间,但日期和匹配项之间仍然没有空格。
【问题讨论】:
-
是的。但是你的代码在哪里?
-
for '<br>' in $half-assed-question { print 'calm down and spell out the details'; } -
如果你的意思是
<table>,那么没有。<br>s 在 HTML 表格的<tr>s 之间无效。不过,您可以放置一个空行——<tr><td>&nbsp;</td></tr>。 -
是的..刚刚发现我可以放置一个空白行.. ty..
-
嗯... HTML 不是 CSS。这个问题与 CSS 无关。
标签: php css mysql html-table