# Username Registration date User's status
1 name 18th, Jul, 2007 12:25 (12:25 AM) Member
in a table. All is well, displays all the users on my site. But I thought:"If my site will have 100+ members, no one would like to search trough an assload of members, just to find one user. I need sorting. Yeah, good idea, but how?"
Tried some coding that didn't work (and I didn't think it would)...
Here be the code
<?php
session_start();
?>
<html>
<head>
<title>Techgeeks.oo.lv - from websites to graphics, to music</title>
<link href='style.css' rel='stylesheet' type='text/css'>
<style type='text/css'>
a:hover { background-color: #666; }
a { text-decoration:none }
</style>
</head>
<body link=#000 alink=#666 vlink=#666>
<?php include('header.php'); include('config.php'); ?>
<div id=wrapper>
<div id=main>
Here, you can see what users have registered.
<?php //Dispaying the users
$query = "SELECT * FROM users"; //Selecting everything what you could want to show
$result = @mysql_query($query);
echo "<table>
<tr>
<th>#</th>
<th>Username</th>
<th>Registration date</th>
<th>User's status</th>
</tr>";
while($row = mysql_fetch_array($result)) //Stops the headers to show after each user
{ //Display all users
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['Username'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Status'] . "</td>";
echo "</tr>";
}
echo "</table>"; //Showing the users
?>
?>
</div>
</div>
</body>
</html>
So, I want it to be something like a form below the users "Sort by (members, administrators, VIP Members). And a submit button. The problem is, I don't know how to do that, and I am confused in what I need: $_GET or $_POST.
Then, if that wouldn't work, I could always try links (that is, click on User's status and it sorts by alphabet), but that seemed a lot of coding, which I don't know.
Also, what would be the correct code to make links like these profiles.php?id=1 display the users profile? And how to display the information on that user, not everyone?
Sorry for the questions, I am new to SQL + PHP.
