能不能帮小弟我看看这段代码出错在哪?谢过!

php中文网
发布: 2016-06-13 13:16:58
原创
1139人浏览过

能不能帮我看看这段代码出错在哪?谢过!!!!!!!!!!
第一个这个是正常显示的...先贴出代码

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->

<form name="form1" method="get" action="search.php">
  <label for="title"></label>
  <div align="center">
    标题
      <input type="text" name="title" id="title">
    <input type="submit" name="submit" id="button" 

value="搜索">
  </div>
</form>
<div align="center">
  <?php 
header("Content-Type:text/html;charset=utf-8");
include("conn.php");
$biaoti=$_GET['title'];
$biaoti2="%".$biaoti."%";
$sql="select * from news where title like '$biaoti2'";
$result=mysql_query($sql,$mylink);
$result2=mysql_fetch_array($result);
$i=0;
echo "搜索内容:".$biaoti;
echo "</br>";
echo "搜索结果总数:".$i;
if($biaoti=="")
{
    echo "模块初始化已完成";
    
    }
    else
    {
?>
  <table width="1079" height="102" border="1">
    <tr>
      <th width="81" height="45" bgcolor="#E2F4F6" scope="col">序号</th>
      <th width="122" bgcolor="#E2F4F6" scope="col">发布所用账号</th>
      <th width="346" bgcolor="#E2F4F6" scope="col">标题</th>
      <th width="192" bgcolor="#E2F4F6" scope="col">时间</th>
      <th width="144" bgcolor="#E2F4F6" scope="col">昵称</th>
      <th width="77" bgcolor="#E2F4F6" scope="col">评论数</th>
      <th width="71" bgcolor="#E2F4F6" scope="col">删除</th>
    </tr>
<?php do
{
?>
    <tr>
      <th height="49" scope="col"><?php echo $commentcount=$result2['id'];?></th>
      <th scope="col"><?php echo $result2['zhanghao'];?></th>
      <th scope="col"><a href="view.php?id=<?php echo $result2['id'];?>">
      <?php echo $result2['title'];?> </a></th>
      <th scope="col"><?php echo date("Y-m-d H:i:s",strtotime($result2['time']));?></th>
      <th scope="col"><?php echo $result2['name'];?></th>
      <th scope="col"> <?php $sql2="select count(*) as abc from tbcomment where id='$commentcount'";
    $sqlquery=mysql_query($sql2,$mylink);
    $result4=mysql_fetch_array($sqlquery);
    echo $result4['abc'];
     ?></th>
      <th scope="col"><a 

href="shanchu.php?id=<?php echo $result2['id'];?>"><?php 
echo "删除";?></a></th>
    </tr><?php 
}
while($result2=mysql_fetch_array($result))
?>
  </table>
</div>

<?php 
}
?>

登录后复制


但我在22行加上一个do {}while()想统计搜索结果总数的时候.....表格中的搜索结果内容就显示不正常了...但搜索结果总数还是显示正常
贴上错误的代码
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->

登录后复制
标题
"; echo "搜索结果总数:".$i; if($biaoti=="") { echo "模块初始化已完成"; } else { ?>
序号 发布所用账号 标题 时间 昵称 评论数 删除
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号