Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    showing users data e.g profile but gtting errors

    hey im using the following code to attemp to get the users data from the db

    Code:
    <?php $query="SELECT * FROM users WHERE Username = '$_GET[username]' LIMIT 1"; 
    $result=mysql_query($query); 
    while($array=mysql_fetch_assoc($result)){
    $pID=$array['ID'];
    $puser=$array['username'];
    }
    
    
    ?>
    
    
    <?php echo $puser . " " . $ID;&#160; ?>
    to get a users data by following a link like mywebsite.com/members/name

    where in the members folder i have
    .htaccess


    Code:
    <?php RewriteEngine on
    RewriteBase /
    RewriteRule ^i([^/.]+)/?$ /images.php?username=$1 
    RewriteRule ^([^/.]+)/?$ members/profile.php?username=$1 [L] ?>
    shouldent $_GET[username] get it either form fact im logged in or from the url itself and display there information?

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    If I were you I'd get your script running without the fancy mod_rewrite stuff first. Just use a normal query string. Once you have the script working with a normal query string, then introduce the mod_rewrite and debug/re-work until that is working.

    p.s. your echo statement is using $ID, which I didn't see assigned to anything anywhere.

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    but i thought i could get the suers id with the username from the table together?

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You can select multiple columns in one query, yes. Though I don't see why you need to select username, since you're using username to determine which row gets selected. In other words, you already have the username value.

  • #5
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    but surly it still should ec the result


  •  

    Posting Permissions

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