Computer Applications

Saturday, January 23, 2010

Update Data In a Database in PHP,MySQL

Code :
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("my_db", $con);
mysql_query("UPDATE Persons SET Age = '36' WHERE FirstName = 'Peter' AND LastName = 'Griffin'");
mysql_close($con);
?>

No comments:

Post a Comment