PHP语法错误,折腾一天了,求高手帮忙。
我写一个无限级分类下拉功能,到下面这个代码老是报错,折腾一天了,求高手看看。
$str_select.= "<option value=" .$row['classid'] if ($classid == $row['classid']){ echo "selected"}.">" .str_repeat( "-" ,$depth) . $row['classname']."</option>"; //字符串构建
错误提示:Parse error: syntax error, unexpected T_IF
回复讨论(解决方案)
求高手帮忙11!
$str_select .= ""; //字符串构建
参考楼上,话说你分开写好了,容易知道错哪
建?不要?在同一行。
如果一定要可以???
$str_select.= "<option value='" .$row['classid']."' ".($classid==$row['classid']? "selected" : "").">" .str_repeat( "-" ,$depth) . $row['classname']."</option>"; //字符串构建

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solving PHPParseerror: syntaxerror, unexpectedendoffile errors When writing PHP code, sometimes we may encounter errors such as "PHPParseerror: syntaxerror, unexpectedendoffile". This error means syntax error, unexpected end of file. There are many reasons for this error, such as missing a

How to deal with syntax errors in PHP Introduction: When developing PHP programs, you often encounter syntax errors. Syntax errors are caused by code that violates PHP syntax rules, which causes the script to fail to execute correctly. This article will introduce some ways to deal with PHP syntax errors and provide corresponding code examples. Using the error prompt function PHP provides a rich error prompt function. These prompts can be turned on during the development process to discover and solve syntax errors in a timely manner. You can set error by

How to solve PHP error: syntax error, nested variables in single quoted string? PHP is a widely used server-side scripting language commonly used to develop web applications. However, when writing code in PHP, you sometimes encounter some errors and problems. One of the common problems is syntax errors when nesting variables within single-quoted strings. This article explains the cause of this problem and provides some workarounds and sample code. Problem description: In PHP, strings can be represented using single quotes or double quotes. when we need

Solve common PHPParseerror:syntaxerror,unexpectedT_VARIABLE errors PHP is a commonly used server-side scripting language, which is widely used in web development. However, during the development process, we sometimes encounter some errors. One of the common errors is "Parseerror: syntaxerror,unexpectedT_VARIABLE" (syntax error, meaning

How to solve PHP error: syntax error, unexpected ")" symbol? When we write PHP code, we sometimes encounter syntax errors. One of the common errors is the unexpected ")" symbol. This kind of error usually causes the code to not execute properly and needs to be fixed. This article will introduce some common causes of this syntax error and provide solutions to help programmers easily solve this problem. Checking Function and Method Parameter Lists One of the most common cases of syntax errors is when function and method parameter lists are written incorrectly. when

When writing PHP code, the error message "PHPParseerror: syntaxerror, unexpectedT_IF" sometimes appears. This error message indicates that there is a syntax error in the code and incorrect syntax is used in the condition of the if statement. In this article, we will cover some common workarounds to avoid this error. Check the conditional syntax of the if statement First, we need to check whether the conditional syntax of the if statement is correct. In the if statement, the condition

How to solve PHP error: syntax error, variable definition is not completed? PHP is a very popular server-side scripting language that is widely used in web development. Like other programming languages, PHP can suffer from various errors and exceptions. Among them, one of the common errors is syntax errors and incomplete definition of variables. When we encounter this kind of error in the code, it may cause the program to fail to run normally, or even directly cause the page to fail to load. But, don’t worry, this article will help you solve this problem. let us

When programming with PHP, we may encounter such an error message: PHPParseerror: syntaxerror, unexpectedT_STRINGin. This error means syntax error, unexpected T_STRING, where T_STRING refers to a string enclosed in quotes. In this article, we will explore the sources and solutions of this error. 1. Source of errors Usually, when we are doing PHP programming, this
