0

Possible Duplicate:
PHP: Warning: sort() expects parameter 1 to be array, resource given

I get the error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\allthewaytthroughmyfolders\www\filterresultaat.php on line 103

while ($regel = mysql_fetch_array ($filterres))    
    {   
            echo   
            '<tr>
            <td>'
            .$regel['Opleiding']. 
            '</td>
            <td>'
            .$regel['S_datum'].
            '</td>
            <td>'
            .$regel['Duur'].
            '</td>
            <td>'
            .$regel['omschrijving'].
            '</td>
            <td>'
            .$regel['vergoeding'].
            '</td>
            <td>'
            .$regel['Stad'].
            '</td>
            <td>'
            .$regel['Straat'].
            '</td>
            <td>'
            .$regel['Huisnr'].
            '</td>
            <td>'
            .$regel['postcode'].
            '</td>
            <td>'
            .$regel['land'].
            '</td>
            <td>'
            .$regel['contactpersoon'].
            '</td>
            </tr>';
}

which is strange since it was working an hour ago.

can anybody help?

EDIT:

if (isset($opleiding)) 
    { $opleidingq = 'opleiding = "'.$opleiding.'" and'; }
if (isset($duur)) 
    { 
        if( $duur = 30)
        {
            $duurq = ' ';
        }
        else
        {
        $duurq= 'duur= "'.$duur.'" and'; 
        }
    }
else
    { $duurq = ' ';
    }
if (isset($type)) 
    { $typeq= 'type= "'.$type.'" and'; }

$filter = "SELECT * FROM opdracht WHERE $opleidingq $duurq $typeq gevuld ='nee';";

//mysql_query($filter);

$filterres = mysql_query($filter);
Community
  • 1
  • 1
Volupion
  • 21
  • 1
  • 4
  • 1
    Can you please post the code for the `$filterres` var? – Nexerus Oct 11 '11 at 10:33
  • Also see [this](http://stackoverflow.com/questions/3899923/php-error-mysqli-num-rows-expects-parameter-1-to-be-mysqli-result-boolean-giv) or [this](http://stackoverflow.com/questions/4988425/mysql-query-boolean-given) – Jan S Oct 11 '11 at 10:40
  • Try var_dump($filterres). If it's empty or just not having the query results, the query failed. Maybe the WHERE statement might throw an error, try removing it! – Anonymous Oct 11 '11 at 10:40

2 Answers2

1

This means that there was an error while executing the query, or no result set was returned, and therefore the result is a boolean. This is causing the warning.

Check the value of $filterres before you enter this code segment, to get rid of the warning.

Jan S
  • 1,805
  • 15
  • 20
0

That happens normally when the sql request does not work. When the syntax is off.

i.e: $condition = 'field=SOME TEXT'; $sql = "SELECT * FROM table WHERE".$condition;

Check the sql request in php MyAdmin.

David Laberge
  • 14,381
  • 14
  • 52
  • 83