我收到了以下警告:
warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given.
当我尝试这段代码时:
$wyn_sport = mysql_query("SELECT a.title, a.content, a.id, FROM article a
LEFT JOIN section s
ON a.id`enter code here`_section=s.id
WHERE s.name='Sport'
ORDER BY date_art desc");
$sport = mysql_fetch_array($wyn_sport, MYSQL_NUM);
$wyn_film = mysql_query( "SELECT a.title, a.content, a.id FROM article a
LEFT join section s on a.id_section=s.id
WHERE s.name='Film'
ORDER BY date_art desc");
$film = mysql_fetch_array($wyn_film, MYSQL_NUM);
$wyn_nauka = mysql_query( "SELECT a.title, a.content, a.id FROM article a
LEFT join section s on a.id_section=s.id
WHERE s.name='Nauka'
ORDER BY date_art desc");
$nauka = mysql_fetch_array($wyn_nauka, MYSQL_NUM);
答案 0 :(得分:0)
这可能意味着您的查询失败并返回false
。然后,您尝试对值mysql_fetch_array()
执行false
。
答案 1 :(得分:0)
@winterblood已经指出了这一点,但这显然是问题...你的查询中有一些随机enter_code_here
不属于
$wyn_sport = mysql_query("SELECT a.title, a.content, a.id, FROM article a
LEFT JOIN section s
ON a.id =s.id
WHERE s.name='Sport'
ORDER BY date_art desc");
if(!$sport = mysql_fetch_array($wyn_sport, MYSQL_NUM)){
echo mysql_error();
}
以上应该有效