简体   繁体   English

如何在php&mysql中更正此“ SQL语法”

[英]how to rectify this “SQL syntax” in php&mysql

i'm trying to create a tagging sys demo here. 我正在尝试在此处创建标签系统演示。 And i'm stumped why i get this error 而且我很困惑为什么我得到这个错误

You have an error in your SQL syntax; 您的SQL语法有误; check the manual that corresponds to your MariaDB server version for the right syntax to use near '#ok )' at line 1 检查与您的MariaDB服务器版本相对应的手册以在第1行的'#ok)'附近使用正确的语法

here is my code: 这是我的代码:

$insert=mysqli_query($conn, 'insert into `hashtag` (posts) values ('.$data1.')') or die(mysqli_error($conn));                        

any help would be appreciated. 任何帮助,将不胜感激。

In mysqli query you don't have to put $conn . 在mysqli查询中,您不必放置$ conn。 Just remove it and in query put like this '".$data1."' And check. 只需将其删除,然后在查询中放入“'。$ data1。”',然后进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM