<?php
session_start();
//Check user is logged in in first place
if(!isset($_SESSION['user']))
{
header("location:******");
}
//Stores mysql login details
$host="localhost"; // Host name
$sql_username="*****"; // Mysql username
$sql_password="*****"; // Mysql password
$db_name="*****"; // Database name
$tbl_name="admin"; // Table name
//mysql Connect variable
$con = mysql_connect("$host","$sql_username","$sql_password");
//Query to retrieve information
$query = "SELECT * FROM admin";
$result = mysql_query($query,$con);
echo "<table border='1'>";
echo "<td><th>Username</th></tr>";
echo '<form action="user_delete.php" method="post">';
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($result))
{
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['id'];
echo "</td></tr>";
echo "<tr><td>";
echo $row['username'];
echo "</td><td>";
echo '<input type="button" value="" />';
echo "</tr></td>";
}
echo "</form></table>";
?>