Update statement
Example:
Update
statement is used to update existing records in a table
Syntax:
Syntax:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
SET column1=value, column2=value2,...
WHERE some_column=some_value
Example:
update emp set name="dev" where
name="Dipak";
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 ='update emp
set name="dev" where name="Dipak" ';
if(mysqli_query($con,
$sql)){
echo "Record updated
successfully";
}
else{
echo "Could
not update record: ". mysqli_error($con);
}
mysqli_close($con);
?>
Output:
Connected
successfully
Record updated
successfully
No comments:
Post a Comment