jamesxg1 Posted February 1, 2009 Share Posted February 1, 2009 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 More sharing options...
revraz Posted February 1, 2009 Share Posted February 1, 2009 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>"); Link to comment https://forums.phpfreaks.com/topic/143392-iv-got-lots-of-php-errors/#findComment-752119 Share on other sites More sharing options...
runnerjp Posted February 1, 2009 Share Posted February 1, 2009 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>"); Link to comment https://forums.phpfreaks.com/topic/143392-iv-got-lots-of-php-errors/#findComment-752121 Share on other sites More sharing options...
jamesxg1 Posted February 1, 2009 Author Share Posted February 1, 2009 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>"); ?> ?? Link to comment https://forums.phpfreaks.com/topic/143392-iv-got-lots-of-php-errors/#findComment-752125 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.