PHP为何显示不出记录?

ssf11126511 2009-11-28 07:39:52
数据库里面明明有数据,它就是死活显示不了,代码我重复看了好几遍了。我觉得应该没有错了啊,为什么就是显示不出来呢??大家帮忙看看到底哪里不对啊?

<?php
$conn=mysql_connect("localhost","root","");
mysql_select_db("lyb",$conn);
mysql_query("set names 'utf8'");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言本</title>
</head>
<body>
<table width="30%" border="0" align="center" cellpadding="5" cellspacing="1">
<?
$sql="select * from ly order by id desc";
$jieguo=mysql_query($sql,$conn);
while($row=mysql_fetch_array($jieguo))
{
?>
<tr>
<td> </td>
<td> </td>
<td><a href="add.php">发表留言</a></td>
</tr>
<tr>
<td>标题:<?=$row[bt]?></td>
<td>作者:<?=$row[zz]?></td>
<td>时间:<?=$row[sj]?></td>
</tr>
<tr>
<td colspan="3"><?=$row[nr]?></td>
</tr>
<?
}
?>
</table>
</body>
</html>
...全文
73 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
dehexiao 2009-11-29
  • 打赏
  • 举报
回复
把错误提示打开,看看上什么错误的呢!
江南昆虫 2009-11-29
  • 打赏
  • 举报
回复
把错误提示打开,在浏览器中查看网页源文件,看看是服务器不发送给你还是浏览器因为编码或标签等原因不给你看。
恋情 2009-11-28
  • 打赏
  • 举报
回复
看看你的httpd.conf有没有开启PHP短标记。
by_baby 2009-11-28
  • 打赏
  • 举报
回复
先要看数据库到底有没有取到数据,print_r($jieguo),或者是你的<? ?>问题
阿_布 2009-11-28
  • 打赏
  • 举报
回复
检查一下短标记开启了没有,phpinfo()可以看。

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧