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:
[code]
<?php
include ‘config.php’;
include ‘navigator.php’;
?>
Navn |
Placering |
Type |
Andet |
ID |
<?php
$result = mysql_query("select * from `ting` ORDER BY `ting`.`id` ASC ");
while ($row = mysql_fetch_array($result)) {
echo “
\n”;
echo “”. $row[‘navn’]." | \n";
echo “”. $row[‘placering’]." | \n";
echo “”. $row[‘type’]." | \n";
echo “”. $row[‘andet’]." | \n";
echo “”. $row[‘id’]." | \n";
echo “
\n”;
}
?>
Fjern Ting:
[/code]
remove.php:
[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 ";
echo “Hjem”;
mysql_close($con);
?>
[/php]
thank you for your help