<!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>
<link href="css/index.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {
color: #FFFFFF;
font-weight: bold;
}
.STYLE2 {color: #FFFFFF}
-->
</style>
</head>
<?php
include "conn/conn.php";?>
?>
<body>
<!-- 头部开始  --><div id="hear">
<div id="top">
<div class="logoleft"><img src="images/top3.png" width="504" height="116" /></div>
<div class="logoright">
<div class="su"><a href="#">客户服务</a> | <a href="#">常见问题</a> | <a href="#">农庄专家</a> | <a href="#">招商加盟</a> | <a href="#">设为主页</a></div>
<div class="st"><img src="images/top5.png" width="500" height="58" /></div>
</div>
</div>
<!-- 导航开始  -->
<div class="mu">
<ul>
<li><a  href="index.php">首 页</a></li>
 <li><a href="about.php">走进农二代</a></li>
 <li><a id="current" href="news.php">新闻中心</a></li>
 <li><a href="topp.html">特种养殖</a></li>
 <li><a href="#">绿色产品</a></li>
 <li><a href="#">园林工程</a></li>
 <li><a href="#">服务范围</a></li>
 <li><a href="#">人力资源</a></li>
  <li><a href="#">客户留言</a></li>
  <li><a href="#">联系我们</a></li>
</ul>
</div>
<!-- 导航结束  -->
<!-- FLASH图片开始  -->
<div id="flash"></div>
<!-- FLASH图片结束  -->
</div>
<!-- 头部结束  --><!-- 中间开始  -->
<div id="mainto">
<div id="mainbg"><img src="images/myy.gif" width="1004" height="14" /></div>
<div id="main">
  <table width="972" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="216" valign="top"><table width="216" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="216" height="54" background="images/dbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="48" height="54">&nbsp;</td>
          <td width="168"><span class="STYLE1">新闻中心 </span><span class="STYLE2">News</span></td>
        </tr>
      </table></td>
    </tr>

    <!-- 左边导航 -->
   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=1">公司新闻</a></strong></td>
        </tr>
      </table></td>
    </tr>

   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=2">行业咨询</a></strong></td>
        </tr>
      </table></td>
    </tr>

   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=3">技术问答</a></strong></td>
        </tr>
      </table></td>
    </tr>

   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=4">成功案例</a></strong></td>
        </tr>
      </table></td>
    </tr>

   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=5">客户评价</a></strong></td>
        </tr>
      </table></td>
    </tr>

   <tr>
      <td height="33" background="images/mdbg.jpg"><table width="216" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="47" height="30">&nbsp;</td>
          <td width="169"><strong><a href="news.php?identification=6">公司服务</a></strong></td>
        </tr>
      </table></td>
    </tr>



 </table></td>
      <td width="20">&nbsp;</td>
      <td width="736" align="left" valign="top"><table width="736" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="3" align="left" valign="top"><table width="736" border="0" cellpadding="0" cellspacing="0" background="images/vvbg.gif">
            <tr>
              <td width="124" height="54" align="center"><a href="news.php"><strong>新闻中心</strong></a></td>
              <td width="420">&nbsp;</td>
              <td width="192" align="center">您现在位置:<a href="index.php">首页</a> &gt; <a href="news.php">新闻中心</a> </td>
            </tr>
          </table></td>
          </tr>
       
   <?php
   
    if($_GET['identification'] != null){
$sql = mysql_query("select * from frontpagenews where identification = ".$_GET['identification']."order by createDate desc limit 0,7");
这里报错 while($result = mysql_fetch_array($sql)){  
?>
<tr>
<td width="28" height="30" align="center"><img src="images/log.gif" width="3" height="5" /></td>
<td width="616" align="left"><a href="newsResult.php"><?php echo mb_substr($result['fpTitle'], 0, 50, 'utf-8').".......";?></a></td>
<td width="92" align="center"><?php echo $result['createDate'];?></td>
        </tr>

<?php
}
}else{

$sql = mysql_query("select * from frontpagenews where identification = 1 order by createDate desc limit 0,7");
while($result = mysql_fetch_array($sql)){
?>
<tr>
          <td width="28" height="30" align="center"><img src="images/log.gif" width="3" height="5" /></td>
          <td width="616" align="left"><a href="newsResult.php"><?php echo mb_substr($result['fpTitle'], 0, 50, 'utf-8').".......";?></a></td>
          <td width="150" align="center"><?php echo $result['createDate'];?></td>
        </tr>
<?php
}
}
   ?>
   
       
                     </table></td>
    </tr>
  </table>
  
</div>
</body>
</html>错误信息

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Apache\htdocs\growers\news.php on line 147php无效sql结果资源mysql

解决方案 »

  1.   

    $sql = mysql_query("select * from frontpagenews where identification = ".$_GET['identification']." order by createDate desc limit 0,7");
      

  2.   

     mysql_query("select * from frontpagenews where identification = ".$_GET['identification']."order by createDate desc limit 0,7");
    除非 $_GET['identification'] 最后的字符是空格,不然 $_GET['identification'] 的值不就和 order 连在一起了?
    如果 $_GET['identification'] = 1
    你的 sql指令不就了
    "select * from frontpagenews where identification = 1order by createDate desc limit 0,7"
    吗?