Kinda new @ this and I can't find this error.

Parse error: parse error in C:\xampp\htdocs\gb_cms\adminmodsubown.php on line 166

[php]session_start();

if(!$_SESSION[‘SESS_ADMINUSER’]) {
header("Location: " . $config_basedir);
}

require(“db.php”);
require(“functions.php”);

function set_validid() {
if(pf_check_number($_GET[‘id’]) == TRUE) {
return $_GET[‘id’];
}
else {
header("Location: " . $config_basedir);
}
}

switch($_GET[‘func’]) {

case “main”:
require(“header.php”);

$subssql = "SELECT gbfaq_subjects.subject, gbfaq_subjects.id FROM gbfaq_subjects

INNER JOIN gbfaq_modsubowner ON gbfaq_subjects.id = gbfaq_modsubowner.sub_id
GROUP BY gbfaq_subjects.id;";
$subsresult = mysql_query($subssql);
$subsnumrows = mysql_num_rows($subsresult);

echo "<h1>Subjects and Ownership</h1>";

if($subsnumrows == 0) {
  echo "No requests have been made.";
}
else {
  while($subsrow = mysql_fetch_assoc($subsresult)) {
    $reqsql = "SELECT gbfaq_users.id AS userid, gbfaq_users.username,

gbfaq_modsubowner.* FROM gbfaq_users INNER JOIN gbfaq_modsubowner ON
modaubowner.user_id = gbfaq_topics.id WHERE gbfaq_modsubowner.sub_id = "
. $subsrow[‘id’] . “;”;
$reqresult = mysql_query($reqsql);

	echo "<table class='visible' cellpadding=10

cellspacing=0>";

    echo "<tr><th class='visible' colspan='4'>Ownership requests for <i>" . $subsrow['subject']

. “”;

    while($reqrow = mysql_fetch_assoc($reqresult)) {
	  echo "<tr>";
	  echo "<td>Requested by      <strong>"

. $reqrow[‘username’] . “”;
echo “

” . $reqrow[‘reasons’] . “”;
echo “<a href=’” . $_SERVER[‘SCRIPT_NAME’] . “?func=accept&id=” . $reqrow[‘id’] . “’>Accept”;
echo “<a href=’” . $_SERVER[‘SCRIPT_NAME’] . “?func=deny&id=” . $reqrow[‘id’] . “’>Deny”;
echo “”;
}
	 echo "</table>";
	 echo "<br />";
    }
}
break;

case "accept":

  $validid = set_validid();
  $sql = "SELECT gbfaq_modsubowner.sub_id, gbfaq_subjects.subject,

gbfaq_users.id AS userid, gbfaq_users.username, gbfaq_users.email FROM
gbfaq_modsubowner.sub_id = gbfaq_subjects.id LEFT JOIN gbfaq_users ON
gbfaq_modsubowner.user_id = gbfaq_users.id WHERE gbfaq_modsubowner.id = "
. $validid . “;”;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$numrows = mysql_num_rows($result);

  $mail_username = $row['username'];
  $mail_email = $row['email'];
  $mail_subject = $row['subject'];

$mail_body=<<<MESSAGE

Hi $mail_username,

I am pleased to inform you that you have been accepted as the new owner of the ‘$mail_subject’ subject.

When you next log into ‘$config_sitename’ you will see the subject in your Control Panel.

Kind Regards,

$config_sitename Administrator

MESSAGE;

mail($mail_email,“Ownership request for " . $mail_subject
. " accepted!”, $mail_body);

$addsql = "UPDATE gbfaq_subjects SET owner_id = " . $row['user_id']

. " WHERE id = " . $row[‘sub_id’] . “;”;
mysql_query($addsql);

$delsql = "DELETE FROM gbfaq_modsubowner WHERE sub_id = "

. $row[‘sub_id’] . “;”;
mysql_query($delsql);

header("Location: " . $config_basedir . "adminmodsubown.php?func=main");
break;

case "deny":
  $validid = set_validid();

  require("header.php");
  echo "<h1>Are you sure that you want to deny this request?</h1>";
  echo "<p>[<a href='adminmodsubown.php?func=denyconf&amp;id="

. $validid . “’>Yes]
[No]”;
break;

case "denyconf":
  $validid = set_validid();

  $sql = "SELECT gbfaq_modsubowner.sub_id, gbfaq_subjects.subject, gbfaq_users.id

AS user_id, gbfaq_users.username, gbfaq_users.email FROM gbfaq_modsubowner
INNER JOIN gbfaq_subjects ON gbfaq_modsubowner.sub_id = gbfaq_subjects.id
LEFT JOIN gbfaq_users ON gbfaq_modsubowner.user_id = gbfaq_users.id
WHERE gbfaq_modsubowner.id = " . $validid . “;”;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$numrows = mysql_num_rows($result);

    $mail_username = $row['username'];
    $mail_email = $row['email'];
    $mail_subject = $row['subject'];

$mail_body=<<<MESSAGE

Hi $mail_username,

I am writing to inform you that your request for ownership of the ‘$mail_subject’ subject has been declined.

Better luck next time!

Kind Regards,

$config_sitename

MESSAGE;

mail($mail_email,“Ownership request for " . $mail_subject
. " denied!”, $mail_body);

$delsql = "DELETE FROM gbfaq_modsubowner WHERE id = " . $validid . “;”;
mysql_query($delsql);

  header("Location: " . $config_basedir . "adminmodsubown.php?func=main");
  break;

}

require(“footer.php”);[/php]

So I copied the file into a new ONE and I believe the problem was white space after MESSAGE; .

After trying it in Notepad++, I’ve come to the same conclusion! That’s a very weird error though.

While I’m here, if you’re using echo without brackets:

[php]echo ‘Some’ . $variable . ‘parts’;[/php]

Then you can use commas instead of periods. Echo will output each part without first having to join the parts together into one string:

[php]echo ‘Some’, $variable, ‘parts’;[/php]

Just a little tip that will help with optimisation :slight_smile:

Thanks for the tip!

Sponsor our Newsletter | Privacy Policy | Terms of Service