• Register now to get access to thousands of Tutorials, Leaked content, Hot NSFW and much more. Join us as we build and grow the community.

Advertise Here

Advertise Here

Advertise Here

Delete Contact Information in PHP/MySQL Using PDO

santi20

Platform Niche Strategist
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
120
Likes
68
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 2 1000 XP
Delete Contact Information

We already did in the tutorial for Insert Contact Information and Update Contact Information. So, I decided to create a follow-up tutorial for Delete Contact Information.

We're gonna use Delete Statement to delete data from our database table.

This is our data.
1_96.png

Delete - PHP Query Using PDO

  1. <?php
  2. require_once

    (

    'db.php'

    )

    ;

  3. $get_id

    =

    $_GET

    [

    'tbl_member_id'

    ]

    ;

  4. // sql to delete a record
  5. $sql

    =

    "Delete from tbl_member where tbl_member_id = '$get_id

    '"

    ;

  6. // use exec() because no results are returned
  7. $conn

    ->

    exec

    (

    $sql

    )

    ;
  8. header

    (

    'location:index.php'

    )

    ;
  9. ?>

Delete Button

  1. <a

    href

    =

    "delete_contact.php<?php echo '?tbl_member_id='.$id; ?>

    ">
  2. <button

    type

    =

    "submit"

    class

    =

    "btn_confirm"

    onclick

    =

    "return confirm(' Delete Contact ( <?php echo $first_name?>

    ) ? ');">
  3. Delete
  4. </

    button

    >
  5. </

    a

    >

Output:

Deleting Data.
11_6.png

After Deleting Data.
2_41.png


Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

452,501

351,349

351,363

Top