Location: PHPKode > projects > Basic Announce > delete_ac.php
<?php

$host="server"; // Host name
$username="user"; // Mysql username
$password="password"; // Mysql password
$db_name="Database"; // Database name
$tbl_name="Table"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// get value of id that sent from address bar
$id=$_GET['id'];

// Delete data in mysql from row that has this id
$sql="DELETE FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);

// if successfully deleted
if($result){
echo "Deleted Successfully";
echo "<BR>";
echo "<a href='delete.php'>Back to main page</a>";
}

else {
echo "ERROR";
}

// close connection
mysql_close();

?>
Return current item: Basic Announce