Deleting data from a table

Spread the love

For deleting data from a table, you can again use the same mysql_query function. You need to pass MySQL delete query in this function.

Example:

<?php
$query = "delete from employees where id = 3";
$result = mysql_query($query, $con);

if(!$result)
{
die("Error deleting data",mysql_error());
}
echo "Data deleted successfully";
?>

You can use all the other SQL queries using mysql_query() function to perform different operations.


Spread the love

Leave a Comment