Results 1 to 9 of 9
  1. #1
    Join Date
    May 2005
    Location
    united kingdom
    Posts
    8,084
    Tokens
    595

    Latest Awards:

    Default PHP Help (again) +REP x 2

    Hey, here's the code:

    PHP Code:
    echo ('<center>Welcome <b> $logged[username] </b><br /></center> 
    This is what's displayed:
    Welcome $logged[username]
    It should be like 'Myke' or w.e their name is.

    and then...

    PHP Code:
    echo ('<a href="members.php?user=$user[username]">$user[username]</a><br />'); 
    Which displays as:
    $user[username]
    Which should display a username.

    Just an add on to the second one:

    PHP Code:
    {
    $getuser mysql_query("SELECT * from users order by id asc");
    while (
    $user mysql_fetch_array($getuser))
    {
    // gets all the users information.
    echo ('<a href="members.php?user=$user[username]">$user[username]</a><br />');
    // links to a page to view the user's profile. 

    drink up this bottle of yeah
    and P A I N T your body on me


  2. #2
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Edit: Nevermind i'm just talking a bunch of nonsense .
    Last edited by --ss--; 10-03-2008 at 04:17 PM.

  3. #3
    Join Date
    Oct 2007
    Location
    UK
    Posts
    471
    Tokens
    0

    Default

    The first one should just be:
    PHP Code:
    echo ("<center>Welcome <b> $logged[username] </b><br /></center>"); 
    Second one:
    PHP Code:
    echo ("<a href=\"members.php?user=$user[username]\">$user[username]</a><br />"); 

  4. #4
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    U missed off the ')' from this one

    echo ("<center>Welcome <b> $logged[username] </b><br /></center>");
    Lets set the stage on fire, and hollywood will be jealous.

  5. #5
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Usually I would go $info["name"]; or what ever your MySQL col name is, What I've read it looks like your building a members system, but this "while" isn't needed unless your processing the whole system of user names.

    I read what D17C and I thought I'd add a bit to it

    Old:
    PHP Code:
    echo ("<a href=\"members.php?user=$user[username]\">$user[username]</a><br />"); 
    Mine:
    PHP Code:
    echo("<a href=\"members.php?user=".$user["username"]."\">."$user["username"]."</a><br />"); 
    To get one user name:

    Original:
    PHP Code:
    $getuser mysql_query("SELECT * from users order by id asc");
    while (
    $user mysql_fetch_array($getuser)) 
    New:
    PHP Code:
    $getuser mysql_query("SELECT * from users WHERE id = 'driftpanzy') or die(mysql_error());
    $user = mysql_fetch_array($getuser);
    ## to find what the array is called, or mysql col name just 
    print_r(
    $user);
    ## that will show the array its fetched.
    echo(
    $user["name"]); 
    Hope that helped
    Hi, names James. I am a web developer.

  6. #6
    Join Date
    May 2005
    Location
    united kingdom
    Posts
    8,084
    Tokens
    595

    Latest Awards:

    Default

    Thanks, I'll +REP you all but I've found a new system now haha.

    edit; given out too much

    drink up this bottle of yeah
    and P A I N T your body on me


  7. #7
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Hope it works well Rep me later on
    Hi, names James. I am a web developer.

  8. #8
    Join Date
    May 2005
    Location
    united kingdom
    Posts
    8,084
    Tokens
    595

    Latest Awards:

    Default

    Drift, got MSGER?

    drink up this bottle of yeah
    and P A I N T your body on me


  9. #9
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    As in MSN, Yes, my email is: [email protected]
    Last edited by Protege; 10-03-2008 at 04:53 PM.
    Hi, names James. I am a web developer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •