问题描述
我在这里很烦人。我一直试图解决这个问题,但奇怪的是我意识到它不在一个目录下,实际上我的整个Web服务器都面临着这个问题。我不能以任何方式在我创建的任何新文档上一次获取,插入或更新多个值,这让我感到困惑,为什么它仍然适用于旧文档,而不是新文档。我甚至将旧的文件复制到新文档中,除了改变它插入的表(使用所有相同的值)之外什么也没做,它产生一个简单的错误,说明'
你的错误在你的SQL语法;查看与您的MySQL服务器版本对应的手册,以便在'Key ='AB123'附近使用正确的语法,IGN ='test'WHERE Name ='testuser''在第1行
'。
整个代码如下:
session_start();
$ name = $ _POST [' name 跨度>];
$ appkey = $ _POST [' appkey 跨度>];
$ usrname = $ _POST [' username 跨度>];
$ birthday = $ _POST [' BirthMonth ']。 。。 $ _POST [' birthday']。 。。 $ _POST [' birthyear'];
$ gender = $ _POST [' 性别跨度>];
$ skype = $ _POST [' phone 跨度>];
$ exp = $ _POST [' exp 跨度>];
$ why = $ _POST [' 为什么跨度>];
include(' db.php');
mysql_query( INSERT INTO查询(名称,密钥,IGN)VALUES('$ name','$ appkey','$ usrname'))或 die(mysql_error());
(是的,它都在正确的标签中。)
我在网上找不到任何答案,我尝试修复它的所有内容都没有。我不希望有一个长字符串插入值。
编辑:我已经回应了字符串,结果就像整个' INSERT INTO查询(名称,密钥,IGN)VALUES('$ name','$ appkey','$ usrname')'字符串,没问题。
解决方案:我没有意识到标签'查询'& 姓名受到保护,所以最后几分钟后,我的IT老师帮助我找到正确的方向。
I am annoyingly confused here. I have been trying to solve this issue, but oddly enough I realize it was not under a single directory, it is actually my entire web server that faces this problem. I cannot in any way get, insert, or update more than one value at a time on any NEW document I create, which confuses me why it still works on old ones, but not on new ones. I have even copied the old ones to the new document and done nothing but alter the table it inserts into (with all the same values) and it produces a simple error stating '
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 'Key='AB123', IGN='test' WHERE Name='testuser'' at line 1
'.
The entire code is below:
session_start(); $name = $_POST['name']; $appkey = $_POST['appkey']; $usrname = $_POST['username']; $birthday = $_POST['BirthMonth'] . "." . $_POST['birthday'] . "." . $_POST['birthyear']; $gender = $_POST['Gender']; $skype = $_POST['phone']; $exp = $_POST['exp']; $why = $_POST['why']; include('db.php'); mysql_query("INSERT INTO query (Name, Key, IGN) VALUES ('$name', '$appkey', '$usrname')") or die(mysql_error());
(Yes, it is all in the proper tags. )
There is no answer I can find online, and everything I try to fix it does nothing. I do not want to have a long string Inserting the values.
EDIT: I have echoed the string and it results as the entire 'INSERT INTO query (Name, Key, IGN) VALUES ('$name', '$appkey', '$usrname')' string, with no problem.
Solution: I did not realize that the tag 'query' & 'Name' are protected, so finally after a few minutes with my IT teacher she help me into the right direction.
这篇关于PHP / MySQL无法更新/插入/获取多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!