2

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

The error is "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in [...] on line 39", line 39 is "$row = mysql_fetch_array($result);". I'm freaking out, what's wrong with it?

Community
  • 1
  • 1
Gabriele
  • 21
  • 3

1 Answers1

4

mysql_query failed and returned FALSE in $result.

You should check the returned value:

$id = mysql_real_escape_string($GET["id"]);
if ($result = mysql_query("SELECT * FROM Setting WHERE ID = '$id'"))
    $row = mysql_fetch_array($result);
else
    print htmlencode(mysql_error()) . "\n";

And of course you should never put $GET["id"] right into the query:

Community
  • 1
  • 1
Quassnoi
  • 398,504
  • 89
  • 603
  • 604