我有这个代码:
<?php
$i=1;
while($i<=10)
{
echo "" . $i . "<br>";
$i++;
}
?>
这列出为:
1 2 3 4 5 6 7 8 9 10
我正在尝试在echo "" . $i . "<br>";
这个<td>
单元格中实现:
<table>
<?php
$data = mysql_query("SELECT board.*,numlikes FROM board
LEFT JOIN (SELECT pins.board_id, COUNT(source_user_id) AS numlikes
FROM likes INNER JOIN pins ON pins.id = likes.pin_id GROUP BY pins.board_id)
likes ON board.id = likes.board_id
WHERE who_can_tag='' ORDER BY numlikes DESC LIMIT 10") or die(mysql_error());
while($info = mysql_fetch_assoc( $data ))
{
Print "<tr>";
Print "<td>";
Print "$i";
Print "</td>";
Print "<td>";
Print "<a href='/board/index/".$info['id']."'><font size='5pt'>".$info['board_name']."</font></a>";
Print "</td>";
Print "<td align='center'>".$info['numlikes']."</td>";
Print "</tr>";
}
?>
</table>
但我得到的只是数字 11 是每个单元格!
我究竟做错了什么?