Jump to content

[SOLVED] else error :( help please


jamesxg1

Recommended Posts

<?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

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

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.