i got complete details in html table and willing to update 2 values

What exactly do you have?

Hi,

You need a php code that updates db from a form like tis?

<?php
db_conect();
$action = isset( $_POST['action'] ) ? $_POST['action'] : "";
if($action == "update"){ 
$query = "update city
set 
name = '".$con->real_escape_string($_POST['name'])."',
state = '".$con->real_escape_string($_POST['state'])."',
population = '".$con->real_escape_string($_POST['population'])."',
zipcode  = '".$con->real_escape_string($_POST['zipcode'])."',
area  = '".$con->real_escape_string($_POST['area'])."',
phone  = '".$con->real_escape_string($_POST['phone'])."',
fax  = '".$con->real_escape_string($_POST['fax'])."'    
where id_city='".$con->real_escape_string($_REQUEST['id'])."'";
if( $con->query($query) ) {
echo '<div class="alert alert-success">City was updated!</div>.';
}else{
echo '<div class="alert alert-danger">Database Error: Unable to update record.</div>';
}
}
?>

Just a heads up, your question is abit bland, spice it up abit with some more detail! :)

Try this:
Update.php

<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

mysqli_query($con,"UPDATE Persons SET Age=36
WHERE FirstName='Peter' AND LastName='Griffin'");

mysqli_close($con);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.