Delete statement:
delete statement is used to delete records from a table
Syntax:
Syntax:
delete form table name
Or
DELETE FROM table_name
WHERE some_column = some_value
WHERE some_column = some_value
Example:
delete from emp where id=101;
Example:
<?php
$servername= 'localhost’;
$username = 'root';
$password = '';
$dbname='lp'
$con =
mysqli_connect($servername, $username, $password,$dbname);
if(! $con )
{
die('Could not connect: ' . mysqli_error());
}
echo 'Connected
successfully';
$sql = "delete
from emp where id=101";
if(mysqli_query($con,
$sql)){
echo "Record deleted
successfully";
}
else{
echo "Could
not deleted record: ". mysqli_error($con);
}
mysqli_close($con);
?>
Output:
Connected
successfully
Record deleted
successfully
No comments:
Post a Comment