Jump to content

Recommended Posts

I am getting a Parse error with the following code. If any of you can spot the error I would be very thankful. I have to be blind to miss it, lol.

 

The Parse error states that:

"Parse error: parse error, unexpected T_STRING in removeuser.php on line 24"

 

 

if($_POST['action'] == :suspend")    is 16th line

 

 

 

if($_POST['action'] == "suspend"){
	$timeNow = time();
	mysql_query("UPDATE Affiliates SET EndEffectiveDate = '$timeNow' 
		WHERE AffiliateID = '".$_POST['deleteuser']."' LIMIT 1") 
        	or die("Database INSERT Error");
	}

	//next line is where the error says the problem is
	$q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '".$_POST['deleteuser']."' "«»);
      		$row1 = mysql_fetch_array($q1);

	$aemailbody = "Dear ".$row1['afirstname'].",\n\nYou have been temporarily suspended from the $siteName.\n\n"
          ."For more info you may contact the Program Manager at the email address below.\n\n"
          ."Affiliate Program Manager\n"
          .$adminEmail."\n\n\n\n";
	if(!mail($row1['aemail'], "Affiliate Program Suspension", $aemailbody, "From:".$adminEmail."\nReply-To:".$adminEmail."\n")){
  		echo "<br><center>Mail Delivery to New Affiliate Failed.</center>";
  	}else{
		echo "Suspend Email sent to Affiliate";
	}

 

Thanks, for the help.

Link to comment
https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/
Share on other sites

Thank you for helping me fix that line of my code. I don't have much PHP knowledge, heh... I am still having parse errors with the code. I will post the entire code, if you wouldn't mind having another look. I know sometimes the error is given because a line or two up is the actual location of the error. Thanks again, for being kind enough to help me.

 

here is the error:

Parse error: parse error, unexpected T_STRING in removeuser.php on line 25

 

<?
session_start();
include "../../sa_config.php";
include "../lang/$language";
if(!sa_admin_check_security()){
    sa_meta_redirect('index.php');
    exit;
}
if ($_REQUEST['deleteuser']){
$con = sa_db_connect();
if(!$con){
	echo "Could not connect to database. ".mysql_error();
	exit;
}
if($_POST['action'] == "suspend"){
	$timeNow = time();
	mysql_query("UPDATE Affiliates SET EndEffectiveDate = '$timeNow' 
		WHERE AffiliateID = '".$_POST['deleteuser']."' LIMIT 1") 
        	or die("Database INSERT Error");

	//send an email to the user that he was suspended
	$q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '".$_POST['deleteuser'].'");
	$row1 = mysql_fetch_array($q1);

	$aemailbody = "Dear ".$row1['afirstname'].",\n\nYou have been temporarily suspended from the $siteName.\n\n"
          ."For more info you may contact the Program Manager at the email address below.\n\n"
          ."Affiliate Program Manager\n"
          .$adminEmail."\n\n\n\n";
	if(!mail($row1['aemail'], "Affiliate Program Suspension", $aemailbody, "From:".$adminEmail."\nReply-To:".$adminEmail."\n")){
  		echo "<br><center>Mail Delivery to New Affiliate Failed.</center>";
  	}else{
		echo "Suspend Email sent to Affiliate";
	}
        
    	sa_meta_redirect('affiliates.php');
	exit;
}
elseif($_POST['action'] == "view"){
	$aid_link = "view_affiliate.php?aid=".$_POST['deleteuser'];
	sa_meta_redirect($aid_link);
	exit;
}
}
include "header.php";
echo "<br><br><center>You are being redirected. If not redirected in 5 seconds you have reached this page in error.";
include "footer.php";
?>

You should use an editor that highlights quoted strings, then you can easily see when quotes are missing.

 

This line is missing quotes:

<?php
$q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '".$_POST['deleteuser']. '");
?>

 

it should be

<?php
$q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '" . $_POST['deleteuser'] . "'");
?>

 

Ken

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.