简体   繁体   English

无法将值插入MySQL表

[英]Unable to insert value to MySQL table

I have installed Prosody and am trying to add users directly to the prosody table instead of prosodyctl command. 我已经安装了Prosody,并且正在尝试将用户直接添加到prosody表中,而不是将用户添加到prosodyctl命令中。

table structure:
================
    `host` TEXT NULL,
    `user` TEXT NULL,
    `store` TEXT NULL,
    `key` TEXT NULL,
    `type` TEXT NULL,
    `value` MEDIUMTEXT NULL,

and when I do this 当我这样做时

$sql = "INSERT INTO prosody (host, user, store, key, type, value) VALUES ('mydomain.tld', $user, 'accounts', 'password', 'string', $pass)";

I get this error 我得到这个错误

"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..." “您的SQL语法有误;请查看与您的MySQL服务器版本相对应的手册,以在...附近使用正确的语法。”

I suspect that certain words are reserved words so I tried using with ' and escaped with \\, but it didn't work. 我怀疑某些词是保留词,所以我尝试与'一起使用,并与\\进行转义,但是没有用。 Same error. 同样的错误。 Can somebody help me? 有人可以帮我吗?

$ sql =“将韵律插入(主机,用户,存储,键,类型,值)值('mydomain.tld','$ user','accounts','password','string','$ pass') “;

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

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