你如何区分结果?将一组行分隔到单独的表中


How do you separate results? Separate a group of rows into separate tables?

我有什么可能是一个简单的问题,但似乎找不到指南或解决方案。

当您运行查询并将结果输出到表中时,如何将结果放入单独的表中并重复,以便出现如下所示

<table>
 <tr><td>title</td><td>date</td>
</tr>
 <tr><td colspan="2">comment</td>
</tr>
Break table and repeat with next result (sperate tables).
 <tr><td>title</td><td>date</td>
</tr>
 <tr><td colspan="2">comment</td>
</tr>
</table>

我希望整个表都是重复的,而不是第一个结果的一部分。

    $row)
echo"<tr>";
echo"<td>"; echo $row['title'] . "</td>";
echo"<td>"; echo $row['date'] . "</td>";
   echo"</tr>";
    echo"<tr>";
echo"<td>"; echo $row['comment'] . "</td>";
   echo"</tr>";
}
我举这个例子是为了更好地解释,对不起。http://www.thermalzombie.com/temp/example.htm

不知道你到底想要什么,但我想这可能会帮助你

<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$result = mysqli_query($con,"SELECT * FROM Persons");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";
while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
mysqli_close($con);
?>
<?php
while($row = mysqli_fetch_array($result))
{   ?>
  <table>
  <tr><td><?php echo $row['title'];?></td><td><?php echo $row['date'];?></td>
  </tr>
  <tr><td colspan="2"><?php echo $row['comment'];?></td>
  </tr>
  </table>
<?php
 }
?>