How to Delete a Row of a MySQL Table Using PHP



PHP







In this article, we show how to delete a row of a MySQL table using PHP.

We can delete any row in the table meeting any type of specification.

For example, we can delete a row where the user's first name is Melissa.

The general format of the MySQL query to delete a row of a MySQL table is shown below.



So the following code above deletes from the table named Users_table where the row called name is equal to Michelle. In other words, we're deleting Michelle from the list of users.

We'll now show how to tie this in with PHP to delete a row from a table.



So, first, we must connect to the database.

After we do this, we create a variable named $deleterow. This $deleterow variable is set equal to a mysql_query() function that has the parameter "DELETE FROM Users_table WHERE name='Michelle'". This deletes the row that contains Michelle in the name column.

So this is how you can delete a row from a MySQL table using PHP.


Related Resources

How to Delete a MySQL Table Using PHP

How to Delete a Column of a MySQL Table Using PHP

How to Delete All Rows of a MySQL Table Using PHP

HTML Comment Box is loading comments...