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 4 of 4

Thread: parse error

  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Exclamation parse error

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/root/public_html/development/processactivation.php on line 55

    The reason I posted this in MYSQL is because line 55 has to do with a SQL query.

    PHP Code:
    <?php
        
    //Start session
        
    session_start();
        
        
    //Include database connection details
        
    require_once('config.php');
        
        
    //Array to store validation errors
        
    $errmsg_arr = array();
        
        
    //Validation error flag
        
    $errflag false;
        
        
    //Connect to mysql server
        
    $link mysql_connect(DB_HOSTDB_USERDB_PASSWORD);
        if(!
    $link) {
            die(
    'Failed to connect to server: ' mysql_error());
        }
        
        
    //Select database
        
    $db mysql_select_db(DB_DATABASE);
        if(!
    $db) {
            die(
    "Unable to select database");
        }
        
        
    //Function to sanitize values received from the form. Prevents SQL injection
        
    function clean($str) {
            
    $str = @trim($str);
            if(
    get_magic_quotes_gpc()) {
                
    $str stripslashes($str);
            }
            return 
    mysql_real_escape_string($str);
        }
        
        
    //Sanitize the POST values
        
    $act clean($_POST['activate']);
        
        
    //Input Validations
        
    if($act == '') {
            
    $errmsg_arr[] = 'Activation field is empty';
            
    $errflag true;
            
            if(
    $act == $_SESSION['SESS_MEMBER_ACT']) {
            
    $errmsg_arr[] = 'Incorrect activation code';
            
    $errflag true;

        }
        if(
    $errflag) {
            
    $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
            
    session_write_close();
            
    header("location: account.php");
            exit();
        }
        
    //Create INSERT query
        
    $qry "UPDATE members SET activation_key = '1' WHERE activation_key = '$_SESSION['SESS_MEMBER_ACT']'");
        
    $result = @mysql_query($qry);
        
        
    //Check whether the query was successful or not
        
    if($result) {
            
    header("location: activatesuccess.php");
            exit();
        }
        else {
            die(
    "Query failed");
        }

        
    ?>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Try
    PHP Code:
    $qry "UPDATE members SET activation_key = '1' WHERE activation_key = '{$_SESSION['SESS_MEMBER_ACT']}'"); 
    Last edited by abduraooft; 10-09-2011 at 02:39 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Ok now i'm receiving the following error

    Parse error: syntax error, unexpected $end in /home/root/public_html/development/processactivation.php on line 68

    line 68 is the very last line of the code, where the '?>' is

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    //Input Validations
        
    if($act == '') { 
    Just count the number of opening and closing braces in your code and identify the missing ones.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Tags for this Thread

    Posting Permissions

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