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 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Isnt displaying ID

    Well its not displaying the id in the address bar heres my php

    PHP Code:
    db mysql_connect($dbHost,$dbUser,$dbPass); // Connection Code
    mysql_select_db($dbname,$db);                 // Connects to database

    if(isset($_POST['submit']))
    {
        
    $username $_POST['username'];
        
    $password $_POST['password'];
        
        
    $sql "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
        
    $que mysql_query($sql);
        
        if(
    mysql_num_rows($que) == 1
        {    
            
    $sql2 "SELECT * FROM `users` WHERE `id` = '$username' ";
            
    $qry mysql_query($sql2) or die(mysql_error());
            
    $post mysql_fetch_array($qry);
        
            
    $sql1 "UPDATE `users` SET active='1' WHERE ID ='".$post['id']."' ";
            
    $ins mysql_query($sql1) or die(mysql_error());
        
            
            
    $_SESSION['username'] = $_POST['username'];
            
    header("Location: profile.php?id='$post[id]'");
        }else
        {
            echo 
    "<font color=\"red\"> Error Wrong Login Details </font>";
            echo 
    "<a href=\"login.php\">Login Page</a>";
        }
    }
    ?> 

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    118
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Change
    PHP Code:
    header("Location: profile.php?id='$post[id]'"); 
    To
    PHP Code:
    header("Location: profile.php?id=$post['id']"); 
    Or
    PHP Code:
    header('Location: profile.php?id='.$post['id'].''); 

  • Users who have thanked CyberPirate for this post:

    Kev0121 (03-26-2009)

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Cheers mate works hehe


  •  

    Posting Permissions

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