0

I'm trying to make a function in which, when a button is pressed, PHP deletes that record from within the database. The website is being redirected with the correct ID, and the DeleteID Variable has the correct value in it, yet for some reason I can't get it to delete the record

Delete.PHP

<?php
session_start();

//get value of ?id= from the url
$DeleteID = $_GET['id'];

echo $DeleteID;
require("connect.php");

//Linking
$link = connectToDB();

//SQL Query
$sql = "DELETE
          FROM tbl_property
          WHERE propetyid = $DeleteID";

//Execute
$result = $link->query($sql);

//Check
if ($link->affected_rows == 1) {
    echo "Worked";
    echo "<a href='properties.php'> SIGH </a>";
}
else {
    echo "Didn't Work";
    echo "<a href='properties.php'> SIGH </a>";
}
?>

Table

enter image description here

shaggy
  • 1,708
  • 2
  • 15
  • 17
MarsBars9459
  • 157
  • 1
  • 1
  • 7

1 Answers1

0

There is a spelling mistake in field name you type propetyid instead of propertyid

$sql = "DELETE
          FROM tbl_property
          WHERE propetyid = $DeleteID";
Poorna Rao
  • 335
  • 4
  • 20