conn.php
<?php
$host="localhost";
$user="root";
$passwd="123456";
$db="bbs";$connection=mysql_connect($host,$user,$passwd) or die ("不能连接".mysql_error() );
mysql_select_db($db) or die ( "不能连接选择数据库" );
mysql_query("set names utf8");
?>list.php<?php include("conn.php");?><table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message";
$query=mysql_query($sql) or die("Error in Query".mysql_error());
while($row=mysql_fetch_array($query)){
?> <tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
zend中的效果:
标题:dfa 用户:adf
内容: df fa
标题: 奋斗 用户:faf啊
浏览器中效果:标题: 用户:
内容: 这是为什么一个显示正常,一个显示不正常,我的程序到底正确不正确!
<?php
$host="localhost";
$user="root";
$passwd="123456";
$db="bbs";$connection=mysql_connect($host,$user,$passwd) or die ("不能连接".mysql_error() );
mysql_select_db($db) or die ( "不能连接选择数据库" );
mysql_query("set names utf8");
?>list.php<?php include("conn.php");?><table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message";
$query=mysql_query($sql) or die("Error in Query".mysql_error());
while($row=mysql_fetch_array($query)){
?> <tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
zend中的效果:
标题:dfa 用户:adf
内容: df fa
标题: 奋斗 用户:faf啊
浏览器中效果:标题: 用户:
内容: 这是为什么一个显示正常,一个显示不正常,我的程序到底正确不正确!
<?
$sql="select * from message";
$query=mysql_query($sql) or die("Error in Query".mysql_error());
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php echo $row['title'];?> 用户:<?php echo $row['user'];?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php echo $row['content'];?></td>
</tr>
<?
}
?>
</table>改过了,zend里能正常运行,浏览器,直接出错了,无法访问
分号去掉
<?php echo $row['content']?>