hey there im wanting to delete from my database using php im new to php and would like help
this is my 2 pages
remove_data.php:<html>
<body>
<?php
include 'config.php';
include 'navigator.php';
?>
<table width="50%" border="1">
<tr>
<td>Navn</td>
<td>Placering</td>
<td>Type</td>
<td>Andet</td>
<td>ID</td>
</tr>
<?php
$result = mysql_query("select * from `ting` ORDER BY `ting`.`id` ASC ");
while ($row = mysql_fetch_array($result)) {
echo "<tr>\n";
echo "<td>". $row['navn']."</td>\n";
echo "<td>". $row['placering']."</td>\n";
echo "<td>". $row['type']."</td>\n";
echo "<td>". $row['andet']."</td>\n";
echo "<td>". $row['id']."</td>\n";
echo "</tr>\n";
}
?>
<form action="remove.php" method="post">
Fjern Ting: <input type="int" name="id" />
<input type="submit" />
</body>
</html>
remove.php:
<?php
include 'config.php';
$sql="DELETE FROM ting (id)
VALUES
('$_POST[id]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record deleted </br>";
echo "<a href=index.php>Hjem</a>";
mysql_close($con);
?>
thank you for your help