Hi,
I'm trying to show all users' username, user id, post count, and avatar on a php page. I know avatars are kept in a seperate table, but I am new to PHP and having trouble figuring out how to get it to match the user's avatarid with the correct avatar from the avatar table. This is what I have now:
I've been able to get it to do something similar to the above with the avatar table... Grab the avatarid, path, title, and such and display it recurringly until it has displayed all of them, but that's as far as I've gotten.
I'm stumped. Can anyone help?!?! Thanks!!
I'm trying to show all users' username, user id, post count, and avatar on a php page. I know avatars are kept in a seperate table, but I am new to PHP and having trouble figuring out how to get it to match the user's avatarid with the correct avatar from the avatar table. This is what I have now:
PHP Code:
<?php
// Request user info
$result = @mysql_query("SELECT * FROM user");
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
//Display the user's info
while ( $row = mysql_fetch_array($result) ) {
echo("<p>" ."Username:". $row['username']. "</p>");
echo("<p>" ."User ID:". $row['userid']. "</p>");
echo("<p>" ."Avatar ID:". $row['avatarid']. "</p>");
$useravatarid = $row['avatarid'];
echo("<p>" ."Posts:". $row['posts']. "</p>");
echo("<br><br>");
}
?>
I'm stumped. Can anyone help?!?! Thanks!!
Comment