(T_ENCAPSED_AND_WHITESPACE),期望标识符(T_STRING)或变量(T_VARIABLE)或number (T_NUM_STRING)
16lz
2021-01-22
I have got Parse error like this:
我有这样的解析错误:
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)或number (T_NUM_STRING)
For below code line
下面的代码行
<?php
$query = "SELECT license_parent_type_details.ParentTypeId,license_parent_type_details.TypeName FROM tenant.license_parent_type_details order by TypeName asc";
$result = mysql_query($query);
while($row_list = mysql_fetch_assoc( $result )) {
For below code line
下面的代码行
echo '<option value="'.$row_list['ParentTypeId'].'">'<"'.($_POST['seltypes']==$row_list['ParentTypeId'] ? ' selected="selected" : '').'>'. $row_list['TypeName']."'</option>';
2 个解决方案
#1
1
Here is the corrected version:
这是更正后的版本:
echo '<option value="', $row_list['ParentTypeId'], '"', ($_POST['seltypes']==$row_list['ParentTypeId'] ? ' selected="selected" ' : ''), '>', $row_list['TypeName'], '</option>';
Mistakes:
错误:
Missing single quote
失踪的单引号
Superfluous double quote
多余的双引号
Finding the original position of those errors is left as an exercise for the reader.
找到这些错误的原始位置留给读者作为练习。
更多相关文章
- 几个有用的php字符串过滤,转换函数代码
- PHP实现接口方法时出现致命错误
- 在Web Page中包含PHP代码
- JSON解析错误:无法识别的标记'<'处于角度
- 在提交注册表单时使用jQuery显示错误
- 获取所有网站的错误,[重复]
- 如何让jQuery ajax执行错误功能
- Yii 访问 Gii(脚手架)时出现 403 错误
- PHP强大包括处理错误?