ph033378 发表于 2015-8-26 09:54:34

看PHP100视频做留言板,list.php一直显示空白

  是个菜鸟没什么好说的,遇到个问题,应该也是粗心所致。
  看PHP100视频做留言板,list.php一直显示空白。

  数据库连接都是木有问题的,代码也是好好的。



1 <?php
2 /*
3* Created on 2011-12-6
4*
5* To change the template for this generated file go to
6* Window - Preferences - PHPeclipse - PHP - Code Templates
7*/
8include("conn.php");
9 ?>
10 <table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
11 <?php
12   $sql="select * from message order by id desc";
13   $query=mysql_query($sql);
14   while($row=mysql_fetch_array($query)){
15 ?>
16   <tr bgcolor="#eff3ff">
17         <td>标题:<a href="xiangxi.php?id=<?=$row?>"><?=$row?></a>用户:<?=$row?></td>
18   </tr>
19   <tr bgcolor="#fff">
20         <td>内容:<?
21          echo htmltocode($row);
22 ?></td>
23   </tr>
24 <?php
25   }
26 ?>
27 </table>


1 <?php
2 /*
3* Created on 2011-12-6
4*
5* To change the template for this generated file go to
6* Window - Preferences - PHPeclipse - PHP - Code Templates
7*/
8$conn=mysql_connect("localhost","root","");
9mysql_select_db("bbs",$conn);
10mysql_query("set names 'GBK'");
11error_reporting(E_ALL & ~E_NOTICE);
12
13function htmltocode($content){
14      $content=str_replace("\n","<br>",str_replace(" ","&nbsp;",$content));
15      return $content;
16}
17 //echo md5('qishuai');
18 ?>
  在家里笔记本上好好的,可以正常显示的,在公司里就不行了,纠结。看网上说有可能没看短标签的,神马居然这个忘了,也是哦,本子上用的是最新版本的wamp,那时应该很及时的开启短标签了。
  公司电脑依然老版本。
  二话不说,还是打开php.ini,short_open_tag = off改为short_open_tag = on
  ok,神马问题都木有了,解决。看来还是得仔细啊。呵呵、、、、
页: [1]
查看完整版本: 看PHP100视频做留言板,list.php一直显示空白