Jump to content

iv got lots of php errors


jamesxg1

Recommended Posts

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\xampp\htdocs\main\DeleteComment.php on line 19

 

 

 

 

these are the errors i have and heres the code

 

DeleteComments.php

 

<?php session_start(); 

require("../db/db.php"); //include database file
require("../db/config.php"); //include configuration file
require("../db/util.php");
require("../db/settings.php");

isloggedin();
accessneeded("C");

?>
<?php
$id = mysql_real_escape_string($_GET['id']);
$username = mysql_real_escape_string($_GET['username']);
$sql = "SELECT * FROM `comments` WHERE `id`='$id' OR `comto`='$username' LIMIT 1";
$query = mysql_query($sql);
$query = "DELETE FROM comments WHERE id = '$id'";
$result = mysql_query($query) or die(mysql_error());
print ("<P ALIGN=CENTER>The comment has been removed<br><a href='../main/profile.php?username=<?php echo $_SESSION['username'] ?>'>Please return to your profile.</a></P>");
?>

 

Link to comment
https://forums.phpfreaks.com/topic/143392-iv-got-lots-of-php-errors/
Share on other sites

Since you are using print, you are already in PHP, so no need to start it again

 

print ("<P ALIGN=CENTER>The comment has been removed<br><a href='../main/profile.php?username=<?php echo $_SESSION['username'] ?>'>Please return to your profile.</a></P>");

 

 

why not just strop your php and start it at link... i like to keep my html and php appart must of the time ( just a preferance)

 

<?php session_start(); 

require("../db/db.php"); //include database file
require("../db/config.php"); //include configuration file
require("../db/util.php");
require("../db/settings.php");

isloggedin();
accessneeded("C");

?>
<?php
$id = mysql_real_escape_string($_GET['id']);
$username = mysql_real_escape_string($_GET['username']);
$sql = "SELECT * FROM `comments` WHERE `id`='$id' OR `comto`='$username' LIMIT 1";
$query = mysql_query($sql);
$query = "DELETE FROM comments WHERE id = '$id'";
$result = mysql_query($query) or die(mysql_error());?>
<CENTER>The comment has been removed<br><a href='../main/profile.php?username=<?php echo $_SESSION['username'] ?>Please return to your profile.</a>");

Since you are using print, you are already in PHP, so no need to start it again

 

print ("<P ALIGN=CENTER>The comment has been removed<br><a href='../main/profile.php?username=<?php echo $_SESSION['username'] ?>'>Please return to your profile.</a></P>");

 

 

u mean instead of this

 

print ("<P ALIGN=CENTER>The comment has been removed<br><a href='../main/profile.php?username=<?php echo $_SESSION['username'] ?>'>Please return to your profile.</a></P>");

?>

 

 

use something like this

 

print ("<P ALIGN=CENTER>The comment has been removed<br><a href='../main/profile.php?username=$_SESSION['username']'>Please return to your profile.</a></P>");

?>

 

??

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.