php 解析错误:语法错误,意外的 '' (T_ENCAPSED_AND_WHITESPACE)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17868387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:35:46  来源:igfitidea点击:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)

phpmysql

提问by user1804933

Full Error: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

完整错误:解析错误:语法错误,意外的 '' (T_ENCAPSED_AND_WHITESPACE),需要标识符 (T_STRING) 或变量 (T_VARIABLE) 或数字 (T_NUM_STRING)

It says that the error is on line 12. Here is what I have there:

它说错误在第 12 行。这是我在那里的内容:

$introduction="INSERT INTO Introduction (Title, Description)
VALUES ('$_POST[introtitle]','$_POST['introdescription']')";

Any help would be greatly appreciated!

任何帮助将不胜感激!

回答by Fabien TheSolution

You have extra single quotes :

你有额外的单引号:

$introduction="INSERT INTO Introduction (Title, Description)
VALUES ('$_POST[introtitle]','$_POST[introdescription]')";