i have a register and login page where the users can register and login. their details gets saved in the database. my requirement is that when the user will login to the account, they should be redirected to their profile page, where they can view all their profile details. Till now i have been able to make the user login and dislay a part of their profile page, for this purpose the code that i am using is

<?php
include('retailer_session.php');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome to your homepage</title>

        <meta name="viewport" content="width=device-width", initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" />
        <link href="css/styles.css" rel="stylesheet" />
        <link href="css/carousel.css" rel="stylesheet">

</head>

<body>
<div id="profile">

    <div class="navbar navbar-inverse navbar-static-top">
        <div class="container">
            <a href="#" class = "navbar-brand"> <id="welcome">Welcome : <i><?php echo $login_session; ?></i> </a>

                <button class = "navbar-toggle" data-toggle = "collapse" data-target = ".navHeaderCollapse">
                    <span class = "icon-bar"> </span>
                    <span class = "icon-bar"> </span>
                    <span class = "icon-bar"> </span>
                </button>

            <div class="collapse navbar-collapse navHeaderCollapse">
                <ul class = "nav navbar-nav navbar-right">
                    <li class ="active"> <a href="admin_profile.php">Home</a></li>
                    <li> <a href="retailer_logout.php"><id="logout">Log Out</a></li>
                </ul>
            </div>
        </div>     
    </div>


</div>

</body>
</html>

Apart from this i want a listing where the user can view their data and edit their details as it is done on many websites. can anyone please help me with the code

Recommended Answers

All 4 Replies

Hi there learner001
I could ask you is this a socialnetwork site?
and if you want the profile page of different users + thier own file inside a folder which the can only see for themselves?

no its not a social network site, its a simple property site where users will be allowed to make their own account and edit their details for further use and each user should be able to see their own profile only

well just so you know different users have different password and identities which in your case put up a database where the user[user_id] -> profile[user_id] database.

use this simple code,to retrive paricular user information

<!DOCTYPE html>
<head></head>
<body>
<?php
session_start();
mysql_connect('localhost','root','') or die (mysql_error());
mysql_select_db('Encrypt') or die("cant select db");
if(isset($_SESSION['username']))  //cheking the user is logged in
{
echo $username = $_SESSION['username'];
echo"<br/>";
echo  "hello".$username."<br>";   //if so,then display user name
}


$sql="SELECT * FROM users WHERE username='$username'";  //retriving the data from data base
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
    $username=$row['username'];
    $_SESSION['username']=$username;
    ?>
    <table border="2px"> <!--displaying the data in table format--->
    <tr><td>username</td><td>password</td><td>Email</td><td>Logged in time</td><td>Edit</td><td>Delete</td></tr>

    <tr><td><?php echo $row['username']; ?> </td><td><?php echo $row['phone']; ?> </td><td><?php echo $row['email']; ?> </td><td><?php echo $row['login']; ?> </td><td><a href="edit.php">Edit</a></td></tr>

    </table>

    </form>
<?php    
}

?>
</body>
</html>

i think it will help.replay me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.