PHP code for profile

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tuananh87vn
    New Member
    • Sep 2007
    • 63

    PHP code for profile

    i'm a PHP newbie and I'm assigned to an mission of creating a blog with some elements like Yahoo blog! : login -> home -> my page, my blog, my profile, my friend....

    I'm now supposed to write the 'view profile page'

    I wrote the login page using session and I'm now stuck. can anyone help me to finish the profile code which shows name, birthday, adress and so on of signed in member using session in form
    [code=php]
    <?php
    echo "hello, you're logging in as". $_SESSION['username'];
    echo '<br>your profile:'
    ?>
    [/code]

    WHAT'S THEN? :|
    Last edited by Atli; Oct 10 '07, 03:50 AM. Reason: Added [code] tags.
  • Jeigh
    New Member
    • Jul 2007
    • 73

    #2
    First you will need to link to the profile page like this:
    Code:
    view_profile.php?username=freddy
    or username=john etc.

    Then use this code at the top:
    [code=php]
    $req_user = trim($_GET['username']);
    [/code]
    Then you just use queries like:
    [code=sql]
    SELECT * FROM members WHERE username='$req_ user'
    [/code]

    To get the data you want. If you want it so only the person who owns that account can view certain information you could just use a code like:
    [code=php]
    $user = $_SESSION['username'];
    [/code]
    then use queries like:
    [code=sql]
    SELECT * FROM members WHERE username='$user '
    [/code]
    Hope that helps :)
    Last edited by Atli; Oct 10 '07, 03:49 AM. Reason: Added [code] tags.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      Please use [code] tags when posting code.

      Thank you.

      Comment

      Working...