我如何在 php 中使用 while 循环创建的 table 下方显示消息

how can i display message below a table created using while loop in php

这是 page.i 在 while 循环到达 table 下方后要显示的消息。下面的代码显示 table 旁边的消息。 我想在 table

下方回显一条消息,例如 "data fetched sucessfully"
<?php
session_start();
$con=mysql_connect("localhost","root","") or die("Could not Connect");
$db=mysql_select_db("practice",$con);
if($_SESSION['user']=="")
{
    header("location:login.php");

}
if(isset($_GET['status']))
{
    $status=$_GET['status'];
    if($status==sucess)
    {
        echo "<h2>Details Updated Succesfully....!!</h2>";
    }
}
echo "Welcome ".$_SESSION['user'];
echo "<br>";
$page=$_GET['page'];
if($page=="" || $page=="1")
{
$page1=0;
}
else
{

  $page1=($page*4)-4;
  }
$query="SELECT * FROM `details` LIMIT $page1,4";
$result=mysql_query($query,$con);
$numrows=mysql_num_rows($result);
if($numrows>0)
{?>
<table  align="left"  border="1" >
<thead>
<tr>
  <th>NAME</th>
  <th>USERNAME</th>
  <th>PASSWORD</th>
  <th>Hobbies</th>
  <th>E-MAIL</th>
  <th>GENDER</th>
  <th>CONTACT</th>
  </thead>
  <tbody>
 <?php
  while($row=mysql_fetch_array($result))
 {?>
 <tr>
  <td><?php  echo $row['name'];?></td>
  <td><?php  echo $row['username'];?></td>
  <td><?php  echo $row['password'];?></td>
   <td><?php echo $row['hobbies'];?></td>
  <td><?php  echo $row['email'];?></td>
  <td><?php  echo $row['gender'];?></td>
  <td><?php  echo $row['contact'];?></td>
  <td><a href="update.php?id=<?php echo $row['id'];?>">Update</a></td>
  <td><a href="delete.php?id=<?php echo $row['id'];?>">Delete</a></td>
 </tr>
<?php

}
echo "data fetched sucessfully";


  ?> 
</tbody>
</table>
</br></br></br></br></br></br></br>
  <?php
$query1="SELECT * FROM `details`";
$result=mysql_query($query1,$con);
$count=mysql_num_rows($result);
$a=ceil($count/4);

for($b=1;$b<=$a;$b++)
{
?><a href="welcome.php?page=<?php echo $b; ?>" style="text-decoration:none"><?php echo $b."";?> </a>



<?php

}

}
else
{
echo "NO Record";

}
mysql_close($con);
    ?>

这个

echo "data fetched sucessfully";
?> 
</tbody>
</table>

表示消息在您的 table 中。它只需要出现在结束 table 标记之后。

?> 
</tbody>
</table>
<?php echo "data fetched sucessfully"; ?>

我认为 <table> 标记中的 align="left" 是导致消息显示在其旁边的原因。无论如何删除它是个好主意,因为这个属性 has been deprecated 不应该被使用。如果需要控制table的位置,可以用CSS代替。