mysql_fetch_array(): supplied argument is not a valid MySQL result resource

來源:互聯網
上載者:User
php 無效sql結果資源 mysql






江蘇農二代農林生態發展有限公司



include "conn/conn.php";

?>
?>







客戶服務 | 常見問題 | 農莊專家 | 招商加盟 | 設為首頁






  • 首 頁

  • 走進農二代

  • 新聞中心

  • 特種養殖

  • 綠色產品

  • 園林工程

  • 服務涵蓋範圍

  • 人力資源

  • 客戶留言

  • 聯絡我們



























































新聞中心 News





公司新聞





行業諮詢





技術問答





成功案例





客戶評價





公司服務


































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"
嗎?

粗心要人命啊。多謝了。少個空格

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.