What is update statement in MySQL with PHP

In this article I am going to explain about MySQL update statement.
  • 1712

MySQL Update statement with PHP

The update statement is used to change the data in one or more row of table based on condition you specify.

Syntax of update statement

UPDATE tableName
SET coluumn1=value,column2=value,.......where columnName=value

In the above update statement set and where clause is used, Here in the set clause specify the value for a column as a literal or an expression, who you want for as updation. And in the where clause, you can specify the conditions that must be met for a row to be updated.

Example of  update  statement

<html>

<body>

<?php

$con = mysql_connect("localhost","gupta","sharad");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

mysql_select_db("Mcn_Solution", $con);

mysql_query("UPDATE Emp SET Id=108 WHERE Fname='Manish'");

 

mysql_close($con);

?>

</body>

</html>


You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.