简体   繁体   中英

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; check the manual that corresponds to your MariaDB server version for the right syntax to use near '#ok )' at line 1

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 . Just remove it and in query put like this '".$data1."' And check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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