Location: PHPKode > projects > Basic Announce > delete_ac.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

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

// if successfully deleted
echo "Deleted Successfully";
echo "<BR>";
echo "<a href='delete.php'>Back to main page</a>";

else {
echo "ERROR";

// close connection

Return current item: Basic Announce