<?php
include_once("FTMdatabase.php");
$id = $_GET['AccountID'];
$sql = "DELETE FROM personaldetails WHERE AccountID = '$id'";
$result = mysql_query($sql, $conn);
$msg = "Data Has Been Removed";
confirm($msg);
mysql_close();
?>
<?php
function confirm($msg)
{
echo "<script language=\"javascript\">
alert(\"".$msg."\");
document.location.href='FTMlogin.php';
</script>";
}
?>
I try this code. But I got an error that says 'AccountID' undefined index. My 1st row in the database is AccountID. Why does it happen?
<?php
include_once("FTMdatabase.php");
$sql="SELECT * FROM personaldetails";
$result = mysql_query($sql, $conn);
while($row = mysql_fetch_array($result))
{
$id = $row['AccountID'];
$name = $row['Name'];
$phone = $row['Phone'];
$car = $row['Car'];
$comment = $row['Comment'];
?>
<table border="1">
<tr><td width="10"><?php echo $id; ?></td>
<td width="10"><?php echo $name; ?></td>
<td width="300"><?php echo $phone; ?></td>
<td width="100"><?php echo $car; ?></td>
<td width="100"><?php echo $comment; ?></td>
</tr>
<td><a href="FTMdelete.php?id=<?php echo $id;?>">
Delete</a>
</table>
<?php
This is where to get $id
. The reason I use $_GET['AccountID']