Page 1 of 1

display user information problem

Posted: Fri Aug 08, 2003 7:22 am
by skateis2s
Ok here is what Im trying to do, I have a page called users.php that shows every user in the database... And I want it when you click on there name it goes to userdetails.php and shows all the information in the rest of the fields.. I'll show you what I have and its not working although close! Please help and thankyou!!!

----------------------------users.php------------------------------------
if ($logged_in_user) {
dbConnect();
$result = mysql_query("SELECT name FROM members");


page_top();
page_header("W e l c o m e  t o  t h e  U s e r s  P a g e.");

echo "<table border='0' width='300' align='center' class='table2' cellspacing='1' cellpadding='3' bgcolor='#000000'>";
echo "<tr><td width='100%' align='center' bgcolor='#0B151F'><font color='#DFA018' size='2'><b>All registered Users</b></font></td></tr>";


while($queryresult = mysql_fetch_array($result)) {
$userinfo = $queryresult["name"];
echo "<tr><td bgcolor='142E45' align='center'><a href='userdetails.php?user=".$userinfo."'>$userinfo</a></td></tr>";
}


echo "</table><br>";
echo "&nbsp;&nbsp;•&nbsp;<a href='members.php?username=".$logged_in_user."'>Go Back</a>";
page_bottom();
}
------------------------------------------------------------------------






----------------------------userdetails.php----------------------------
if ($logged_in_user) {
dbConnect();
$result = mysql_query("SELECT * FROM members WHERE name = '".$userinfo."'");

page_top();
page_header("User Details on ".$userinfo.".");

echo "<table border='0' width='300' align='center' class='table2' cellspacing='1' cellpadding='3' bgcolor='#000000'>";

while($queryresult = mysql_fetch_array($result)) {
echo "<tr><td width='50%' bgcolor='#142E45'><b>First Name:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["first_name"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>Last Name:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["last_name"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>Age:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["age"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>Sex:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["sex"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>State:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["state"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>Email:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["email"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>Aim/Aol Screenname:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["aolsn"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>MSN:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["msn"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>ICQ:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["icq"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>CS Nickname:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["cs_nickname"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>Playing for:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["time_playing"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>Favorite Map:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["fav_map"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#142E45'><b>Favorite Weapon:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["fav_weapon"]."</td></tr>";
echo "<tr><td width='50%' bgcolor='#09111B'><b>Favorite Team:</b></td><td width='50%' bgcolor='#000000'>".$queryresult["fav_team"]."</td></tr>";
}

echo "</table>";
page_bottom();

}
-----------------------------------------------------------------------


I dont understand why its not working, it shows information for 1 user on every user that you click, any help would be gratefull, so thankyou! :D
:lol:

Posted: Fri Aug 08, 2003 8:16 am
by skateis2s
anyone?

Posted: Fri Aug 08, 2003 8:12 pm
by McGruff
I'd like to help but that's a lot of code to hunt through (easier to assimilate if you enclose in

Code: Select all

BBcode tags).

Can you be more specific about the problem, ie are you getting error messages, some vars display but others do not etc?

Lots of people will be willing to help but it's much easier to do that with more (and less..) information. I mean, tell us exactly what the problem is and try and identify just a few lines of code which might be relevant - if possible.

Posted: Fri Aug 08, 2003 9:03 pm
by skateis2s
I figured it out :) I was up till 8am, lol