PHP Basic Tutorial
MySQL Connection
Updating data in a MySQL table using PHP involves executing an SQL UPDATE statement through either procedural or object-oriented approaches.
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
table_name
: The name of the table (e.g., users
).SET
: Specifies the columns and their new values.WHERE
: Limits which rows are updated (use it carefully to avoid updating all rows).The following example updates the name
and age
of the user with id=1
.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>