Weirdness, my code below is simply to delete entries in a MySQL database. I am executing my code and then using Header("Location"); to take the user back to the page they came from. In other functions, it works fine and in others it doesn't. Like the one below
It's giving me an error as does when HTML is outputted before the header, but the script is still being executed and it's giving the header error.
Does anyone know why it is giving the error on some and no errors on others?
This code below gives no header error
Anyone?
PHP Code:
function delete($id){
$this->id = $id;
$this->connect();
$query = "DELETE FROM blog WHERE id='{$this->id}'";
mysql_query($query) or die(mysql_error());
$queery = "DELETE FROM comments WHERE bid='{$this->id}'";
mysql_query($queery) or die(mysql_error());
Header("Location: main.php?mode=cp&cpmode=deletepost&id=$this->id");
}
Does anyone know why it is giving the error on some and no errors on others?
This code below gives no header error
PHP Code:
function editEntry($author,$topic,$email,$mood,$entry,$id){
$this->author = $author;
$this->topic = $topic;
$this->email = $email;
$this->mood = $mood;
$this->entry = $entry;
$this->id = $id;
$this->connect("localhost","root","rootpass","test");
$this->emoticons();
$this->parsed = nl2br($this->parsed);
$query = "UPDATE blog SET author='{$this->author}', topic='{$this->topic}', email ='{$this->email}', mood='{$this->mood}', entry='{$this->parsed}', np='{$this->entry}' WHERE id='{$this->id}'";
mysql_query($query) or die(mysql_error());
Header("Location: main.php?mode=cp&cpmode=view");
}
Comment