Today in development encountered on the parse Error:syntax error, unexpected $end errors, according to their own to examine here may be if else did not appear in pairs, let us summarize the problems and solutions.
May be unfamiliar with some features of PHP, but write more, also slowly adapt to the will ...
Here is a code to write debugging problems, the error is as follows:
Parse error:syntax error, unexpected $end in d:xampphtdocsguestbookguestbook.php on line 330
Look at the program line 330, the last line of code, what's wrong with that? Google search, found:
In PHP 5, the following error could appears as an error entry in Apache error log or simply displays on PHP Web page, even I F calling to PHP scripts with Php_info () works perfectly and successfully returns information on PHP configurations:
Parse error:syntax Error, unexpected $end in ..... scripts.php on line ...
The error may caused to 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 is broke up an D distributed into multiple files, or to multiple PHP blocks, unless the break is within a method declaration.
But more commonly, the error was often caused by the use of the short Open tags in PHP,
To use the short open tags, it must is enabled in PHP. Ini. Search for Short_open_tag in PHP. INI, and change the value to on. The line should:
Short_open_tag = On
Is it bad for me to cheat my english? Look at a few other searches, did not mention the point, then look at English, although not as translated, the general meaning is to see understand:
Error occurs when a short label is used and can be set in php.ini Short_open_tag = On
The original parse error hint is usually a syntax error, using an open tag, the statement is not the end of the programming basic errors, such as the end of the sentence without notice ";" or if () {...} after forgetting "}"; forget "?>". Check the code carefully, sure enough is a missing "}", modify the program to run properly
Instance
conn.php
/*
* Bkjiajob v1.0
* PROGRAMMER:MSN/QQ haowubai@hotmail.com (925939)
* www.php100.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 code;
function Htmtocode ($content) {
$content = Str_replace ("n", "
", Str_replace (" "," ", $content));
return $content;
}
$content =str_replace ("'", "'", $content);
Htmlspecialchars ();
?>
/*
* Bkjiajob v1.0
* PROGRAMMER:MSN/QQ 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]); ?> |
}
?>
Run the error that appears below
Parse error:syntax error, unexpected $end in e:wampwwwleave_messagelist.php on line 35
The reason for the error is here
}
?>
Change into
}
?>
Solution
You can change the title, the content, the user's three . function is
This is not the main, at most just show no data
The reason for the error is here
}
?>
Change into
}
?>
http://www.bkjia.com/PHPjc/632209.html www.bkjia.com true http://www.bkjia.com/PHPjc/632209.html techarticle today in development encountered about the parse Error:syntax error, unexpected $end errors, according to their own to examine here may be if else did not appear in pairs, let us summarize ...