tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Can someone tell me what's wrong with this code, because I don't know....I just know that it won't delete what I want it do:
<?php
$id = $_POST['id'];
$connection=mysql_connect("localhost", "username", "password")
or die(mysql_error());
mysql_select_db('database')
or die(mysql_error());
$result = "DELETE FROM news WHERE id='$id'";
mysql_query($result)
or die(mysql_error());
header("Location: newsdelete.php");
?>
<?php
$id = $_POST['id'];
$result = "DELETE FROM news WHERE id='$id'";
echo $result;
?>
Now try to run exactly that query (copy -> paste) in phpMyAdmin or whatever you use.
If there's an error, sql will give you a good description (most of the time) so you can solve it.