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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unexpected T_STRING

    I am getting the following error:

    Code:
    Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/main/loginfunc.php on line 39
    Line 39 is where I am trying to update the lastlogin field in the db.

    What am I doing wrong?

    Here is my php code:

    PHP Code:
    <?php
    session_start
    ();

    //include our db data to make the connection
    include ('db.php');

    //get form data
    $username $_POST["form_username"];
    $password md5($_POST["form_password"]);

    //pull all the data from users table
    $content mysql_query("SELECT * FROM users WHERE username = '$username'");

        while(
    $row mysql_fetch_array($content)) {
            
    $db_id $row['id'];
              
    $db_password $row['password'];
            
    $db_username $row['username'];
            
    $db_function $row['ismod'];
              }
    /*        
    echo 'form username: '.$_POST["form_username"].'<br />';
    echo 'form password: '.$password.'<br />';
    echo 'db username: '.$db_username.'<br />';
    echo 'db password: '.$db_password;
    */


    if ($password !== $db_password) {
        
    header("Location: index.php?page=login&error=fail");
    } else {
        
    $_SESSION['logged_in'] = 1;
        
    $_SESSION['username'] = $db_username;
        
    $_SESSION['function'] = $db_function;
        
    header("Location: index.php?page=home");
        
        
        
    //update the lastlogin field in the db
        
    $date date("F j, Y, g:i a");
        
    mysql_query("UPDATE users SET lastlogin='$date' WHERE id=$db_id") or die mysql_error());    
    }

    ?>
    Thank you!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Missed one ( at
    Code:
    mysql_query("UPDATE users SET lastlogin='$date' WHERE id=$db_id")
     or die( mysql_error());
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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