<?php
if( isset($_POST['']) && isset($_POST['']) ){
$code=$_POST[''];
$name=$_POST[''];
// Соединяемся, выбираем базу данных
$query = "INSERT INTO AndroidHelper (name,code) VALUES ('$name','$code')";
mysql_query($query);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
// Закрываем соединение
mysql_close($link);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Добавление файла</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="addFile.php" method="POST">
Название: <input type="text" name="name" style="width: 200px;"><br>
<p>Код:</p><textarea rows="100" cols="150" name="code"></textarea><br>
<input type="submit" style="padding: 10px" value="Добавить"/>
</form>
</body>
</html>
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
DurationFormatUtils.formatDuration(Integer.valueOf(trackBean.duration) * 1000, "mm:ss", true);
Если обычный текст добавлять то работает все.
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'org.apache.commons', name: 'commons-lang3', version: '3.4' DurationFormatUt' at line 1
Попробуйте:
$name = mysql_escape_string($_POST['name']);
$code = mysql_escape_string($_POST['code']);
$query = "INSERT INTO AndroidHelper (name,code) VALUES ('" . $name . "','" . $code . "')";
З.Ы. Используйте mysqli или PDO mySQL.
Сборка персонального компьютера от Artline: умный выбор для современных пользователей