grim2594 Posted January 22, 2009 Share Posted January 22, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/ Share on other sites More sharing options...
Philip Posted January 22, 2009 Share Posted January 22, 2009 $q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '".$_POST['deleteuser']."' "«»); You have the ' and the " mixed up, try this: $q1 = mysql_query("SELECT * FROM Affiliates WHERE AffiliateID = '".$_POST['deleteuser'].'"); Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-743404 Share on other sites More sharing options...
grim2594 Posted January 22, 2009 Author Share Posted January 22, 2009 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-743742 Share on other sites More sharing options...
kenrbnsn Posted January 22, 2009 Share Posted January 22, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-743763 Share on other sites More sharing options...
grim2594 Posted January 23, 2009 Author Share Posted January 23, 2009 That worked! Thank you so much for your time! By the way, do you have a preference of software to use? Such as what you describe that I should use? I guess anything is better than notepad, lol. Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-743901 Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 I use Notepad++, cliche name but it's free and a very good editor Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-743902 Share on other sites More sharing options...
Philip Posted January 23, 2009 Share Posted January 23, 2009 HTML-Kit is pretty good, it's what I use. Take a look at this thread: http://www.phpfreaks.com/forums/index.php/topic,54859.0.html It has a list of editors, people have voted, etc. Quote Link to comment https://forums.phpfreaks.com/topic/141970-need-help-with-parse-error/#findComment-744036 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.