vendredi 8 mai 2015

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

this is the display page.i want to dislay message after while loop gets over below the table .the code below displays the message beside the table. I want to echo a message such as "data fetched sucessfully" below the table

<?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);
    ?>

Aucun commentaire:

Enregistrer un commentaire