conn.php
<?php/*
* PHP100Job v1.0
* Programmer : Msn/QQ [email protected] (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("数据库链接错误");
mysql_select_db("news", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;function htmtocode($content) {
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}//$content=str_replace("'","‘",$content);
//htmlspecialchars();
?><?php/*
* PHP100Job v1.0
* Programmer : Msn/QQ [email protected] (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)){
?><table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?
echo htmtocode($row[content]);
?></td>
</tr>
</table>
<?
}
?>
运行出现下边的错误
Parse error: syntax error, unexpected $end in E:\wamp\www\leave_message\list.php on line 35 帮忙解决,不胜感激
<?php/*
* PHP100Job v1.0
* Programmer : Msn/QQ [email protected] (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("数据库链接错误");
mysql_select_db("news", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;function htmtocode($content) {
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}//$content=str_replace("'","‘",$content);
//htmlspecialchars();
?><?php/*
* PHP100Job v1.0
* Programmer : Msn/QQ [email protected] (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)){
?><table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?
echo htmtocode($row[content]);
?></td>
</tr>
</table>
<?
}
?>
运行出现下边的错误
Parse error: syntax error, unexpected $end in E:\wamp\www\leave_message\list.php on line 35 帮忙解决,不胜感激
这附近的代码发出来看看
报错的原因在这里
<?
}
?>
改成
<?php
}
?>