...

View Full Version : need help with my Member list



Matt_coder
04-12-2012, 12:25 PM
im trying to display all registered users, my code is below.
when i load the page it only show one of my users instead of all what do i add?
also i would probably need to add a way of just showing 10 per page


<?php

include 'connect.php';
include 'header.php';
if($_SESSION['signed_in'] == false)
{
//the user is not signed in
echo '<a href="/forum/signin.php">sign in</a>to see our users';
}
else
{
}


$nuser=$_SESSION['user_name'];
$auser=$_SESSION['user_level'];

if($nuser)
{
$userfinal=$nuser;
}
else
if($auser)
{
$userfinal=$auser;
}
if(isset($userfinal))
{

$Members = mysql_query("SELECT * FROM users WHERE user_level ='0' ORDER BY user_id DESC ") or die(mysql_error());
$name = mysql_fetch_array($Members);
$numRowsMembers = mysql_num_rows($Members);
}
for($count = 1; $count <= $numRowsMembers; $count++)
{
}

echo '<a href="member_profile.php?username=' .$name['user_name'] .'">' .$name['user_name'] .'</a>';


echo '<br/>';
include 'footer.php';
?>
thanks

abduraooft
04-12-2012, 12:53 PM
$Members = mysql_query("SELECT * FROM users WHERE user_level ='0' ORDER BY user_id DESC ") or die(mysql_error());
$name = mysql_fetch_array($Members);
$numRowsMembers = mysql_num_rows($Members);
}
for($count = 1; $count <= $numRowsMembers; $count++)
{
}

echo '<a href="member_profile.php?username=' .$name['user_name'] .'">' .$name['user_name'] .'</a>';


echo '<br/>';
That should be something like


$Members = mysql_query("SELECT * FROM users WHERE user_level ='0' ORDER BY user_id DESC ") or die(mysql_error());

$numRowsMembers = mysql_num_rows($Members);
if ($numRowsMembers>0){
while($row= mysql_fetch_array($Members)){

echo '<a href="member_profile.php?username=' .$row['user_name'] .'">' .$row['user_name'] .'</a>';


echo '<br/>';
}
}

Matt_coder
04-12-2012, 01:20 PM
That should be something like


$Members = mysql_query("SELECT * FROM users WHERE user_level ='0' ORDER BY user_id DESC ") or die(mysql_error());

$numRowsMembers = mysql_num_rows($Members);
if ($numRowsMembers>0){
while($row= mysql_fetch_array($Members)){

echo '<a href="member_profile.php?username=' .$row['user_name'] .'">' .$row['user_name'] .'</a>';


echo '<br/>';
}
}
Thank you its working :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum