帮助查找“解析错误:语法错误,意外T_STRING” [英] help finding "Parse error: syntax error, unexpected T_STRING"

查看:76
本文介绍了帮助查找“解析错误:语法错误,意外T_STRING”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新手试图让我的第一个代码工作,yada yada yada。


我有一个下拉框,选择一个状态,然后将后期数据发送到''processform2.php''使用它来拉出所有具有相应状态的行。

我得到这个''解析错误:语法错误,/ home / attorney /中的意外T_STRING第13行的public_html /''

Hi I am a newbie trying to get some of my first code working, yada yada yada.

I have a drop down box which chooses a state then takes the post data to ''processform2.php'' to use that to pull up all the rows which have the corresponding state.
I am getting this ''Parse error: syntax error, unexpected T_STRING in /home/attorney/public_html/'' on line 13

展开 | 选择 | Wrap | 行号

推荐答案

偏移51处的撇号关闭字符串,之后你有e使用命令end(;)或字符串连接运算符(。)。


请保护您的SQL免受SQL注入(例如通过mysql_real_escape_string())
the apostrophe at offset 51 closes the string, after that you have to use the command end (;) or string concatenation operator (.).

and please please secure your SQL against SQL Injection (e.g. by means of mysql_real_escape_string())


第13行搞砸了很多。首先,您的查询无效。它会返回结果,但不是你的想法。 WHERE子句需要一个条件,您要选择的每一行必须满足。如果您要说WHERE 1,则会选择所有行。如果你要说WHERE`id` = 1,则只有`id` = 1的行。是真的会被选中。条件不仅仅是一个变量。


其次,你不能在相同类型的引号内使用相同类型的引号而不转义它们(使用& ; \字符。


第三,数组不使用括号作为下标;它们使用括号([和和])。


第四,
Line 13 is messed up a lot. Firstly, your query is invalid. It will return results, but not what you think. The WHERE clause requires a condition that each row that you want to select has to meet. If you were to say "WHERE 1", then all rows would be selected. If you were to say "WHERE `id` = 1", then only rows where "`id` = 1" is true would be selected. Conditions are more than just a single variable.

Secondly, you can''t have the same type of quotation marks inside of the same type of quotation marks without escaping them (using the "\" character).

Thirdly, arrays do not use parentheses for subscript; they use brackets ("[" and "]").

Fourthly, all data in the


_POST数组中的所有数据都是用户输入。因此,它的原始形式是不安全的。使用 mysql_real_escape_string()进行清理。
_POST array is user input. Therefore, it is unsafe in its raw form. Cleanse it using mysql_real_escape_string().


这篇关于帮助查找“解析错误:语法错误,意外T_STRING”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆