• Thu, Nov 2024

How to Remove/ delete data from PostgreSQL using PHP

How to Remove/ delete data from PostgreSQL using PHP

In this tutorial, we will learn how to delete the record or data in PostgreSQL using PHP.

Code for data deletion from the database. Put this code on top of the delete.php file.

<?php include_once('config.php');
 
if(isset($_GET['deleteid']))
{
$did=intval($_GET['deleteid']);
$sql=pg_query($conn,"delete from employee where ID=$did");
echo "<script>alert('Data deleted Sucessfully');</script>";
echo "<script>window.location.href = 'read.php'</script>";    
}
?>