-2

I received the following warning :

warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given.

When I try this code :

$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);
Alireza41
  • 1,412
  • 4
  • 21
  • 32

2 Answers2

0

That would probably mean your query is failing and returns false. You are then trying to perform mysql_fetch_array() on a value of false.

Ken Herbert
  • 5,127
  • 5
  • 28
  • 37
  • Look at the comment with the link as a possible duplicate above (second one for your actual question) - it will give you some ideas on how to sift out errors like that. – Ken Herbert Mar 26 '13 at 23:14
0

@winterblood already pointed this out, but this is clearly the issue ... You have some random enter_code_here in your query where it doesn't belong

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

}

The above should work

What have you tried
  • 10,650
  • 4
  • 30
  • 45