$strSQL = "INSERT INTO depts(id,text) values('" . $_POST["id"] ., . $_POST["text"] . "')";
Ошибка Parse error: syntax error, unexpected ',' in.
$strSQL = "INSERT INTO depts(id,text) values('" . $_POST["id"] ., . $_POST["text"] . "')";
$strSQL = "INSERT INTO depts(id,text) values('" . $_POST["id"] . $_POST["text"] . "')";
<html>
<head>
<title>Отправка формы</title>
</head>
<body>
<h1>Отправка формы</h1>
<form action="" method="POST">
Введите номер:
<input type="text" name="id" />
<br/>
Введите текст:
<br/>
<input type="text" name="text" />
<br/>
<input type="submit" value="Отправить" />
</form>
</body>
</html>
$strSQL = "INSERT INTO depts (id,text) values (".(int)$_POST["id"].", '".$_POST["text"]."')";
INSERT INTO depts (id,text) values (1, 'текст')
$strSQL = "INSERT INTO depts(id,text) values('" . $_POST["id"] . "', '" . $_POST["text"] . "')";
$strSQL = "INSERT INTO depts(`id`,`text`) values($_POST[id], '" . $_POST['text'] . "')";
$res = mysql_query($strSQL) or die(mysql_error());
$name = $_POST['name'];
$strSQL = mysql_query("INSERT INTO depts (name) VALUES('$name')");
Цитата (Valick) |
а не вставляется, потому что в имени поля использовано зарезервированное слово text |