当前位置:Gxlcms >
PHP教程 >
mysql_fetch_array():suppliedargumentisnotavalidMySQLresultresource
mysql_fetch_array():suppliedargumentisnotavalidMySQLresultresource
时间:2021-07-01 10:21:17
帮助过:4人阅读
php 无效sql结果资源 mysql
江苏农二代农林生态发展有限公司 include "conn/conn.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)){ ?> | | | } }else{ $sql = mysql_query("select * from frontpagenews where identification = 1 order by createDate desc limit 0,7"); while($result = mysql_fetch_array($sql)){ ?> | | | } } ?> |
错误信息
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Apache\htdocs\growers\news.php on line 147
回复讨论(解决方案)
$sql = mysql_query("select * from frontpagenews where identification = ".$_GET['identification']." order by createDate desc limit 0,7");
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"
吗?
粗心要人命啊。多谢了。少个空格