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 Quote 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" ? Quote 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 Quote 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 ! Quote 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, Quote 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. Quote 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 Quote 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); Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.