Accurax Posted December 13, 2006 Share Posted December 13, 2006 I have a member list that displays all my members names, and allows your to view each members profile by clicking on the generated links.I'd like to take this a ittle further now and also display each members picture next to their name, however i cant seem to get my head arround it.Can anyone help?Heres what I have at the moment[code]<?phpsession_start();include("include.inc");if ( $_SESSION['login'] != "true" ) { header("location: hacker.php"); }else { echo "<h1 align='center'>Here is our Member List<br /></h1>"; }$connection=mysql_connect($host, $user, $passwd) or die ("Could not connect !");$db = mysql_select_db($database, $connection) or die ("Could not connect to Database");$user_query = "SELECT user_name FROM members";$result = mysql_query($user_query) or die ("cant get links"); $row = mysql_fetch_array($result);$profilename = $row[user_name];$user_picture = "SELECT picture FROM members WHERE user_name='$profilename'$";$result = mysql_query($user_picture) or die ("cant get pictures"); $row = mysql_fetch_array($result);$picture = $row[picture];echo '<a href="view_profile.php?user_name='.$row['user_name'].'">'; echo $row['user_name']; echo "</a>";echo "<br>";echo '<img src="$picture" width="200" height="40" title="Logo" />';$profile = $row['user_name'];while ( $row = mysql_fetch_array($result)){echo '<a href="view_profile.php?user_name='.$row['user_name'].'">'; echo $row['user_name']; echo "</a>";echo "<br>";}?>[/code]By the way, at the moment its defaulting to the "or die" statement for the SELECT picture query. Link to comment https://forums.phpfreaks.com/topic/30512-member-list-picture-display/ Share on other sites More sharing options...
ki Posted December 13, 2006 Share Posted December 13, 2006 instead of fetch array, use mysql_fetch_object Link to comment https://forums.phpfreaks.com/topic/30512-member-list-picture-display/#findComment-140469 Share on other sites More sharing options...
timmah1 Posted December 13, 2006 Share Posted December 13, 2006 This is assuming that you have 2 different databases, which I have.This works for meYou can see what I mean here[url=http://fotobins.com/test.php]http://fotobins.com/test.php[/url][code]$user_query = "SELECT username FROM users";$result = mysql_query($user_query) or die ("cant get links"); $row = mysql_fetch_array($result);$profilename = $row[username];$photo_query = "SELECT * FROM photos WHERE username = '$row[username]'";$result1 = mysql_query($photo_query) or die ("cant get photos"); $row = mysql_fetch_array($result1);$photoname = $row[file];echo "$row[username] - $row[file]";[/code] Link to comment https://forums.phpfreaks.com/topic/30512-member-list-picture-display/#findComment-140478 Share on other sites More sharing options...
Accurax Posted December 13, 2006 Author Share Posted December 13, 2006 Im using one database in all honestyBut... i have managed to get it working thanks to an old thread i dug up from last year sometime lol.I'm starting to do some formatting on it now, and will probably have some questions sometime tomorrow on multiple page displays etc... ill have a go myself first thoughThanks guys Link to comment https://forums.phpfreaks.com/topic/30512-member-list-picture-display/#findComment-140482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.