I am trying to show the user logged in his information that he added at time of register. I have been pulling code from the internet and would like to understand it better so I can fix things on my own.
Currently when you log in it displays the most recent persons information that has registered on the site instead of showing the persons information that just logged in.
I do not understand what variables are being assigned and how exactly im telling the variable that it now stands for what ever row im attaching it to.
This is my code that is displaying the wrong information. Please explain each line and code such as whats a variable and whats just an embedded command. Then if you could explain why it is showing the information from who last registered instead of the person currently logged in...
<?php
$db="login";
$link = mysql_connect("localhost", "root", "");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM users" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
$i=0;
while ($i<$num_rows )
{
$first=mysql_result($result, $i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$username=mysql_result($result,$i,"username");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
$i++;
}
echo "<b>Username: $username</b><br>Phone: $phone<br>Mobile: $mobile<br>E-mail: $email<br>Web: $web<br><hr><br>";
mysql_close($link);
?>
Thanks!!!!


