Maybe it's some of the unfamiliar php features, but if I write too much, I will gradually adapt to it. here I will sort out a code compilation debugging problem with the following error: Parseerror: syntaxerr
Maybe it's some of the unfamiliar php features, but if I write too much, I will gradually adapt to it. here I will sort out a code compilation debugging problem with the following error: Parse error: syntax error, unexpected $ end in D: xampphtdocsguestBookguestBook. php on line 330
First, let's take a look at the program's 330 lines and the last line of code. what is the error? Google search:
In PHP 5, the following error may appears as an error entry in Apache error log or simply displays on PHP web page, even if calling to php scripts with php_info () works perfectly and successfully returns information on PHP deployments:
Parse Error: syntax error, unexpected $ end in ..... Scripts. php on line...
The error may caused by a missing curly bracket in PHP script coding. beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.
But more commonly, the error is often caused by the use of Short Open tags in PHP,
To use short open tags, it must be enabled in PHP. INI. Search for short_open_tag in PHP. INI, and change the value to On. The line shoshould look line:
Short_open_tag = On
I am not good at English? Look at several other searches without having said anything, so let's take a look at English. although it cannot be translated as a data translation, it means you understand it:
The error occurs when a short tag is used. you can set short_open_tag = On in php. ini.
The original Parse error prompt is generally a syntax error. an open label is used, and the statement is not terminated, that is, some basic programming errors. for example, if () or () {...} I forgot "}"; Forgot "?> ". Check the code carefully. The "}" is missing. the modified program runs normally. instance:
Conn. php
-
- /*
- * PHP100Job v1.0
- * Programmer: Msn/QQ Co., haowubai@hotmail.com (925939)
- * Www.phpfensi.com Develop a project PHP-MySQL-Apache
- * Window 2003-Preferences-PHPeclipse-PHP-Code Templates
- */
- $ Conn = @ mysql_connect ("localhost", "root", "dong") or die ("database link error ");
- Mysql_select_db ("news", $ conn );
- Mysql_query ("set names 'gbk'"); // use GBK Chinese encoding;
- Function htmtocode ($ content ){
- $ Content = str_replace ("n ","
", Str_replace (" "," ", $ content ));
- Return $ content;
- }
- // $ Content = str_replace ("'", "'", $ content );
- // Htmlspecialchars ();
-
- ?>
-
- /*
- * PHP100Job v1.0
- * Programmer: Msn/QQ Co., haowubai@hotmail.com (925939)
- * Www.php100.com Develop a project PHP-MySQL-Apache
- * Window 2003-Preferences-PHPeclipse-PHP-Code Templates
- */
- Include ("conn. php ");
- Include ("head. php ");
- $ SQL = "SELECT * FROM 'message' order by id desc ";
- $ Query = mysql_query ($ SQL );
- While ($ row = mysql_fetch_array ($ query )){
- ?>
-
-
- Title: User:
-
-
- Content:
- Echo htmtocode ($ row [content]);
- ?>
-
-
-
- }
- ?>
The following error occurs during running.
Parse error: syntax error, unexpected $ end in E: wampwwwleave_messagelist.php on line 35
The error is reported here. Change
Solution:You change the title, content, and user That's all. Function , This is not the main one, but it is not displayed at most.