jamesxg1 Posted February 24, 2009 Share Posted February 24, 2009 <?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"); $id = mysql_real_escape_string($_GET['id']); $usID = mysql_real_escape_string($_GET['usID']); $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()); }else{ header('Location: ../main/profileerror.php'); ?> Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\main\DeleteComment.php on line 19 Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/ Share on other sites More sharing options...
samshel Posted February 24, 2009 Share Posted February 24, 2009 else is associated with an "if", where is the "if" ? Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769663 Share on other sites More sharing options...
jamesxg1 Posted February 24, 2009 Author Share Posted February 24, 2009 else is associated with an "if", where is the "if" ? hiya, no i need it to re-direct upon completetion Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769667 Share on other sites More sharing options...
samshel Posted February 24, 2009 Share Posted February 24, 2009 cool ! please mark as solved ! Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769669 Share on other sites More sharing options...
jamesxg1 Posted February 24, 2009 Author Share Posted February 24, 2009 cool ! please mark as solved ! ermmmm i would but i havent solved it :S, Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769673 Share on other sites More sharing options...
samshel Posted February 24, 2009 Share Posted February 24, 2009 remove the "} else {" line, if u dont have to check for anythign before redirection. Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769676 Share on other sites More sharing options...
jamesxg1 Posted February 24, 2009 Author Share Posted February 24, 2009 remove the "} else {" line, if u dont have to check for anythign before redirection. ok thankyou worked , sorry one last thing how do i add vars in the url eg <?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"); $id = mysql_real_escape_string($_GET['id']); $usID = mysql_real_escape_string($_GET['usID']); $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()); header('Location: ../main/profile.php?usID=$usID&username=$username'); ?> the url just comes out like this http://localhost/main/profile.php?usID=$usID&username=$username Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769678 Share on other sites More sharing options...
samshel Posted February 24, 2009 Share Posted February 24, 2009 change to header('Location: ../main/profile.php?usID='.$usID.'&username='.$username); Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769681 Share on other sites More sharing options...
jamesxg1 Posted February 24, 2009 Author Share Posted February 24, 2009 change to header('Location: ../main/profile.php?usID='.$usID.'&username='.$username); Thanks mate your a (*) Cheers!. James. Link to comment https://forums.phpfreaks.com/topic/146609-solved-else-error-help-please/#findComment-769682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.