I am a beginner to PHP. I want to make an HTML-form, that updates data in database. This is the form:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Apartments</title>
</head>
<body>
<form action="test_upd.php" method="POST">
<p>Введите данные, которые вы хотите изменить:</p>
<p>Фамилия <input type="text" name="nm" size="10"></p>
</form>
</body>
</html>
And this is script:
<?php
$n = $_POST['nm'];
$link = mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db('apartments', $link) or die(mysql_error());
$query = "UPDATE Customers SET name (".$n");" //Customers - table, name - column in this table
mysql_query($query);
mysql_close($link);
echo "Запись изменена!";
?>
But when I try to update data, I get an error... What am I doing wrong?