...

View Full Version : parse error



amcf1992
10-09-2011, 03:44 AM
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
//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_HOST, DB_USER, DB_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");
}


?>

abduraooft
10-09-2011, 02:34 PM
Try
$qry = "UPDATE members SET activation_key = '1' WHERE activation_key = '{$_SESSION['SESS_MEMBER_ACT']}'");

amcf1992
10-09-2011, 05:16 PM
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

abduraooft
10-09-2011, 05:28 PM
//Input Validations
if($act == '') {
Just count the number of opening and closing braces in your code and identify the missing ones.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum