PHP MySQL Delete query- Php Mysql Create Database - Phptpoint.com

PHP MySQL Delete

PHP Summer Training/Internship with 2 Live Projects in Noida Fee is only 5500/-Click here to Book Your Seat.

/ins>

PHP MySQL Delete

DELETE keyword is used basically to delete 1 or more than one records from the database table.even if we delete each and every row of a table then also the schema of the table remain un deleted. It,s necessary to use where clause in delete query, otherwise all the records will be deleted.

Syntax

Note : Notice the WHERE clause in the DELETE syntax is must otherwise all records will be deleted!

Eg 1

Previous records in empInfo table are:

Emp_idNameEmailMobile
1deveshdevesh@gmail.com9910099100
2deepakdeepak@gmail.com9210053520
3raviravi@gmail.com9810098100

 

This example deleted one row from “empInfo” table

After deletion , the “empInfo” table will look like this:

Emp_idNameEmailMobile
2deepakdeepak@gmail.com9210053520
3raviravi@gmail.com9810098100

In the above example ,
empInfo table has 3 records of devesh,deepak, and ravi.
we need to delete a record from this table.
The record of devesh here is to be deleted.

here first we create connection with the database,then database is selected using mysql_select_db(),
then delete query is passed to the mysql_query and the table row is deleted.

Latest Trending Technologies