Update Record in php

 Update simple Record

if(isset($_POST[“update”]))
{
$rid = $_POST[‘id’];
$finame = $_POST[“fname”];
$query1 = “UPDATE users SET FirstName= ‘”.$_POST[fname].”‘, LastName= ‘”.$_POST[lname].”‘, Mobn= ‘”.$_POST[mobile].”‘, Email='”.$_POST[email].”‘ WHERE  Id='”.$rid.”‘”;   // Update Query
$up = mysql_query($query1,$con);
if($up)
{

die(“location.href = ‘SearchandUpdate.php'”);  //if header Function not then use die function.  this use redirect another page.

//header function – header(‘Location:SearchandUpdate.php’); same use die function.

}
else
{
echo “Error : Data not Updated !!!”;    //Error  message.
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s