0
我收到此错误信息:如何使用Textarea将此数据存储在数据库中?
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 'Hello World'; ?>')' at line 1
我期待存储以下数据:
<?php echo 'Hello World'; ?>
这是我的代码:
if(isset($_POST['submit'])){
$post = $_POST['post'];
$tqs = "INSERT INTO ttn03 (post) VALUES ('$post')";
$tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc));
echo "The data has gotten successfully added.";
}
使用这两个没有为工作me:
htmlspecialchars();
htmlentities();
这是HTML表单:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<textarea name="post" value=""></textarea>
<br/>
<input type="submit" name="submit"/>
</form>
数据库归类是:
utf8_unicode_ci
这是我的头:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
有什么建议?
** STOP投掷的数据。 **我不知道是谁给了你直接在SQL中抛出'$ post'数据的想法,但他应该被枪杀。 – Christian 2014-10-04 09:59:33