April 4, 2016
Delete / Remove Records In Database Using PHP & MySQLi

Hello, friends in this tutorials I show you how to delete/remove records in the database using PHP & MySQL. Insert records into MySQL table, you can delete records from a MySQL table using the SQL DELETE statement. It is used in conjugation with the WHERE condition to delete only those records that match specific rules or condition. The basic syntax of the DELETE statement can be given with: DELETE FROM table_name WHERE column_name=given_value.
delete.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php $server = "localhost"; $user = "root"; $pass = ""; $dbname = "info"; // Create connection in mysqli $conn = new mysqli($server, $user, $pass, $dbname); //Check connection in mysqli if($conn->connect_error){ die("Connection failed" .$conn->connect_error); } //Delete record from mysql $delete = "DELETE FROM info WHERE id=1"; if($conn->query($delete) === TRUE){ echo "Deleted Sucessfully"; } else { echo "Error" .$conn->error; } $conn->close(); ?> |
Download
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]