jwk811 Posted October 22, 2006 Share Posted October 22, 2006 something is wrond with the else but i dont know what im doing wrong[code] echo "<strong><font color='red'>Your account could not be activated, no user found by that id or password!</font></strong>"; } else { echo "<strong>Your account has been activated!</strong> You may login below!<br />"; include ( './login.php' ); }}else{ echo "<strong>You have already activated your account!</strong> You may login below!<br />"; include ( './login.php' );}[/code]it says in the errorParse error: parse error, unexpected T_ELSE in /home/content/j/w/k/jwk811/html/membership/activate.php on line 28not sure what that means.. Quote Link to comment Share on other sites More sharing options...
EngineeringGuy Posted October 22, 2006 Share Posted October 22, 2006 Do you have an if statement? Also, depending on the code above it, you may have too many } Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 22, 2006 Author Share Posted October 22, 2006 heres the entire script.. its to activate a user[code]<?/* Account activation script */// Get database connectioninclude ( './db.php' );// Create variables from URL.// first check if it's already been activated$sql = mysql_query ( "SELECT COUNT(*) AS total FROM users WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "' AND activated = 1" ) or die ( 'Query Error: ' . mysql_error );$found = mysql_fetch_assoc ( $sql );if ( $found['total'] == 0 ){ $sql = mysql_query ( "UPDATE users SET activated = 1 WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "'" ) or die ( 'Query Error: ' . mysql_error ); if ( mysql_affected_rows ( $sql ) == 0 ) { die(mysql_error()); } { echo "<strong><font color='red'>Your account could not be activated, no user found by that id or password!</font></strong>"; } else { echo "<strong>Your account has been activated!</strong> You may login below!<br />"; include ( './login.php' ); }}else{ echo "<strong>You have already activated your account!</strong> You may login below!<br />"; include ( './login.php' );}?>[/code]i didnt write it so i wouldnt know much on why its wrong cuz im not all that great with this just yet... please let me know if you find any problems with this.. if its the if thing.. how would i set it up? thanks again Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 22, 2006 Author Share Posted October 22, 2006 do you know what the problem is anyone? please help me Quote Link to comment Share on other sites More sharing options...
Design Posted October 22, 2006 Share Posted October 22, 2006 i'm getting this error lately too on one of my scripts, i'm pretty sure that it means you have more than 1 else { } statement in an if statement Quote Link to comment Share on other sites More sharing options...
sasa Posted October 24, 2006 Share Posted October 24, 2006 try[code]<?/* Account activation script */// Get database connectioninclude ( './db.php' );// Create variables from URL.// first check if it's already been activated$sql = mysql_query ( "SELECT COUNT(*) AS total FROM users WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "' AND activated = 1" ) or die ( 'Query Error: ' . mysql_error );$found = mysql_fetch_assoc ( $sql );if ( $found['total'] == 0 ){ $sql = mysql_query ( "UPDATE users SET activated = 1 WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "'" ) or die ( 'Query Error: ' . mysql_error ); if ( mysql_affected_rows ( $sql ) == 0 ) { echo "<strong><font color='red'>Your account could not be activated, no user found by that id or password!</font></strong>"; die(mysql_error()); } else { echo "<strong>Your account has been activated!</strong> You may login below!<br />"; include ( './login.php' ); }}else{ echo "<strong>You have already activated your account!</strong> You may login below!<br />"; include ( './login.php' );}?>[/code] Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted October 24, 2006 Share Posted October 24, 2006 The error is occuring because on line 25 you have an open curly bracket [color=green][b]{[/b][/color] but it's not preceeded by an [color=green][b]else[/b][/color].The code that sasa's provided should clear it up.RegardsHuggie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.