When deciding how to develop Members Areas on your Site. It is always a chore to remember how to pass the users data from Page To Page. The Script Below will help.
FIRST PAGE --------WE SHOW ALL MEMBERS
<?php
$res = mysql_query('select id, username, email, mempic, date from users desc');
if(mysql_num_rows($res)>0)
{
$result = mysql_fetch_array($res);
}
?>
//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No users data found"; //PLACE ERROR HERE
}
?>
SHOW OUR DATA----
<ul><h3>Members List</h3></ul>
<ul>
<li>User/Id</li>
<li>Image/Path</li> // OR USERS URL PATH TO IMAGE change img tag path below&page-2 ! //
<li>User/Name</li>
<li>Email</li>
<li>Date/Joined</li>
</ul>
<ul> // NEXT WE PARSE THE USERS ID VALUE USING THE LINK
<li><a href="profile.php?id=<?php echo $result['id']; ?>">View User</li>
<li><?php echo $result['mempic']; ?></li>
<li><?php echo $result['username']; ?></li>
<li><?php echo $result['email']; ?></li>
<li><?php echo $result['date']; ?></li>
</ul>
<p>Scripts By Robin Deatherage about2mount@gmail.com</p>
SECOND PAGE SINGLE MEMBERS PAGE
<?php
if(isset($_GET['id'])) //FIRST WE GET THE ID OF USER FROM FIRST PAGE//
{
$id = intval($_GET['id']); // WE ASSIGN A VARIABLE//
$dn = mysql_query('select id, username, email, mempic, date from users where id="'.$id.'"');
if(mysql_num_rows($dn)>0)
{
$dnn = mysql_fetch_array($dn);
}
//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No user data found"; //PLACE ERROR HERE//
}
?>
NOW SHOW THE USERS DATA.
// NEXT WE PARSE THE the single users data
<h3>Profile Page</h3>
<h4>Welcome: <?php echo $dnn['username']; ?>
<p><img src="<?php echo $dnn['mempic']; ?>"></p>
<ul>
<li><a href="profile.php?id=<?php echo $dnn['id']; ?>">View User</li>
<li><?php echo $dnn['username']; ?></li>
<li><?php echo $dnn['email']; ?></li>
<li><?php echo $dnn['date']; ?></li>
</ul>
GO DOWN HERE AND IF YOU WANT CREATE A ANOTHER PAGE FOR WHATEVER YOU WANT USING THE SECRETS ABOVE ! ENJOY !
TO SHOW THE MEMBERS IMAGE ABOVE USE THIS LINE-->
ReplyDeleteimg src=""alt="Avatar" style="max-width:125px;max-height:125px;" />