PHP MySQL Delete record with confirmation popup using jquery ajax

PHP MySQL Delete record with confirmation popup using jquery ajax

In this Post We Will Explain About is PHP MySQL Delete record with confirmation popup using jquery ajax With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php confirm delete popup Example

In this post we will show you Best way to implement delete confirmation message in javascript php, hear for confirmation popup box before delete record using PHP jquery and Mysql with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :  Simple Digital Clock with Date using VueJS

php mysql delete record with confirmation example

In this Example,First of all Add or Include External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priority set.After that Include your relevant CSS Class.

1. database_config.php

Create New Table

CREATE TABLE `students` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Include External Libs

    <title>PHP MySQL Delete record with confirmation popup using jquery ajax</title>
<!--Pakainfo.com Latest all the compiled and minified CSS -->


Create index.php File

<div class="container">
    <h3 class="text-center">How to Delete Data from MySQL with Confirmation in PHP</h3>
    <table class="table table-bordered">
        <tr>
            <th>Student Name</th>
            <th>Student Email</th>
            <th>Action</th>
        </tr>
        query($sql);
        while($stud = $students->fetch_assoc()){
        ?>
            <tr id="">
                <td></td>
                <td></td>
                <td><button class="btn btn-danger btn-sm remove">Remove</button></td>
            </tr>
        
    </table>
</div> 

index.js

 $(".remove").click(function(){
        var id = $(this).parents("tr").attr("id");


        if(confirm('Are you sure to remove Students ?'))
        {
            $.ajax({
               url: '/row_delete.php',
               type: 'GET',
               data: {id: id},
               error: function() {
                  alert('Jquery Something is wrong');
               },
               success: function(data) {
                    $("#"+id).remove();
                    alert("Your student Record removed successfully");  
               }
            });
        }
    });

Make row_delete.php File

query($my_sql);
	 echo 'Student Deleted successfully.';
}
?>

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Also Read :  Installing Windows step by step - Install Windows 7

Example

I hope you have Got What is How to Delete Data from MySQL with Confirmation in PHP And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Recommended For You.

jQuery Add Remove Class on mouseOver mouseOut
Today, We want to share with you jQuery Add Remove Class on mouseOver mouseOut.In this post we will show you

Add a Comment

Your email address will not be published. Required fields are marked *