electricbeat
Account Closed
- Impact
- 0
I have a browse.php file that shows all the user members. I need it so I have a-b-c-d-e- etc listed at the top and also show 10 users on each page aswell, so basically like the vbulletin memberlist.php file.
I need this basically http://195.137.45.236/memberlist.php but just the users alphabetically ordered, if anyone could help it would be great and I'd give all of my NP if I have any.
I need this basically http://195.137.45.236/memberlist.php but just the users alphabetically ordered, if anyone could help it would be great and I'd give all of my NP if I have any.
PHP:
<?php
ob_start();
include("config.php");
if (!$_GET[user]){
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = "20"; // Change to how many member you would like to display per page
$from = (($page * $max_results) - $max_results);
$getuser = mysql_query("SELECT * FROM users ORDER BY id ASC LIMIT $from, $max_results");
while ($user = mysql_fetch_array($getuser)){
// gets all the users information.
echo ("<a href=\"browse.php?user=$user[username]\">$user[username]</a><br />\n");
// links to a page to view the user's profile.
}
echo "Go to page: ";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM users"),0);
$total_pages = ceil($total_results / $max_results);
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" title=\"Go to page $i\">$i</a> ";
}
}
} else {
$getuser = mysql_query("SELECT * FROM users WHERE username = '$_GET[user]'");
$usernum = mysql_num_rows($getuser);
if ($usernum == 0){
echo ("User Not Found");
} else {
$profile = mysql_fetch_array($getuser);
echo ("Username: <i>$profile[username]</i><br />
Location: <i>$profile[location]</i><br />
Email: <i>$profile[email]</i><br><br>
<b>Music Interests</b><br />
1. $profile[artist1] - <i>$profile[song1]</i><br />
2. $profile[artist2] - <i>$profile[song2]</i><br />
3. $profile[artist3] - <i>$profile[song3]</i><br />
4. $profile[artist4] - <i>$profile[song4]</i><br />
5. $profile[artist5] - <i>$profile[song5]</i><br />
6. $profile[artist6] - <i>$profile[song6]</i><br />
7. $profile[artist7] - <i>$profile[song7]</i><br />
8. $profile[artist8] - <i>$profile[song8]</i><br />
9. $profile[artist9] - <i>$profile[song9]</i><br />
10. $profile[artist10] - <i>$profile[song10]</i><br />
");
// in the above code, we display the user's information.
}
}
?>








