Hi,

I have created a database, where it is possible to create posts and see them on a different page.

On the page where it's possible to see all the records I want to create a delete link so it is possible to delete the record where you have pressed the delete link.

I have written some code, but it doesn't delete the record it only refreshes the page witch is called se_kunder.php

Can you please help me with what's missing? aren't I executing the delete sql query, or how do I do that?

I hope you understand what I meen.
Thank you for your help.
Here is the code:

Code PHP:
 
<?php
$con = mysql_connect("xxx","xxx","xxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
mysql_select_db("xxx", $con);
 
$id = $row['ID'];
$result = mysql_query($sql);
 
 
 
 
$result = mysql_query("SELECT * FROM kunder");
 
 
 
 
$sql = "DELETE FROM kunder WHERE ID='$id'"; 
 
 
 
while($row = mysql_fetch_array($result))
 
 
 
  echo "<b>NY KUNDE</b>" . "<br><br><b /><u>Virksomhedsnavn</u></b><br>" . $row['Virksomhedsnavn'] . "<br><br><b><u>CVR. nummer</u></b> <br> " . $row['cvrnummer']  . 
  "<br><br><b /><u>Kontaktperson</u></b><br>" . $row['kontaktperson'] . "<br><br><b><u>E-mail</u></b> <br> " . $row['email'] . 
  "<br><br><b /><u>kundenummer</u></b><br>" . $row['kundenummer'] . "<br><br><b><u>fakturanummer</u></b> <br> " . $row['fakturanummer'] .
  "<br><br><b /><u>oprettet</u></b><br>" . $row['oprettet'] . "<br><br><b><u>brugernavn til ftp</u></b> <br> " . $row['brugerftp'] .
  "<br><br><b /><u>kodeord til ftp</u></b><br>" . $row['passftp'] . "<br><br><b><u>brugernavn til cms</u></b> <br> " . $row['brugercms'] .
  "<br><br><b /><u>kodeord til cms</u></b><br>" . $row['passcms'] . "<br><br><b><u>udbyder</u></b> <br> " . $row['hosters'] .
  "<br><br><b /><u>betalt</u></b><br>" . $row['betalt'] . "<br><br><b><u>skal betale senest</u></b> <br> " . $row['betalsenest'] .
  "<br><br><b /><u>send neste faktura</u></b><br>" . $row['nestefaktura'] . "<br><br><b><u>pris</u></b> <br> " . $row['pris'] . 
  "<br><br><b /><u>webadresse</u></b><br>" . $row['webadresse'] . "<br><br><b><u>link til faktura</u></b> <br> " . $row['fakturaurl'] .    
  "<br><br><b /><u>link til projektbeskrivelse</u></b><br>" . $row['projektbeskrivelseurl'] . "<br><br><b><u>noter</u></b> <br> " . $row['noter']. "<br><br>" .
  '<a href="se_kunder.php?id=$id\">Slet</a>' .
  "<br><br>" .
  "<hr />";;
 
 
 
mysql_close($con);
?>