So, I checked the first 5 pages and couldn't find anything like what I'm asking. When a user registers on my site, it automatically creates a new directory and uploads a picture of their choice, to the directory. When the user logs in, the webpage shows their photo, taken from the new directory, and is supposed to show the photo of everyone else registered. It doesn't, only the picture of the person logged in. The two pieces of code are exactly the same, except that one says name!=$name and the other is the name of the user. I thought it was the database but it is displaying other information from it. Please help.
session_start();
require('connect/connect.php');
$name=$_SESSION['name'];
echo '<table id="intro"><b>';
echo '<tr><td>Welcome: ' . $_SESSION['name'] . '</td></tr>';
echo '<tr><td>Your Login Id is: ' . $_SESSION['loginid'] . '</td></tr>';
echo '</b></table>';
echo '<br>A photo about me:<br><br>';
$dresult=mysql_query("SELECT description,photo FROM demographics WHERE name='$name'") or DIE(mysql_error());
while($drow=mysql_fetch_array($dresult)){
$image=$drow['photo'];
echo '<img src="pages/' . $name . '/' . $image . '" style="height:20%; width:30%;"/><br>';
echo '<p>Why this photo represents me</p>';
echo $drow['description'];
}
?>
<br><br>
<a href="login/inputupdate.php">I want to update my information</a><br>
<div id="right">
<?php
echo '<p>Here are others registered for the site:</p>';
$result=mysql_query("SELECT name,photo,lastlogin FROM demographics WHERE name!='$name'") or DIE(mysql_error());
while($row=mysql_fetch_array($result)){
echo '<table>';
$image=$row['photo'];
echo '<tr><td><img src="pages/' . $name . '/' . $image . '"style="height:20%; width:30%;"/></td></tr>';
echo '<tr><td>' . $row['name'] . '</td></tr>';
echo '<tr><td>Last Login: ' . date('M d Y', strtotime($row['lastlogin'])) . '</td></tr></table>';
}
?>