-2

我收到以下警告:

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);
4

2 回答 2

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();

}

以上应该工作

于 2013-03-26T23:07:06.977 回答
0

这可能意味着您的查询失败并返回false。然后,您尝试mysql_fetch_array()执行false.

于 2013-03-26T22:56:38.680 回答