警告:mysql_fetch_array()期望参数1是资源,布尔给定[重复]

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

I have the following PHP code but get this error. I tried different solutions but it does not seem to work. Any help would be greatly appreciated.

<?php
INCLUDE 'functions.php' ;

$host = 'localhost';    
$id = '***';    
$pwd = '***';    
$db = '****'; 

$myconnection = connect_db($host, $id, $pwd, $db);

$SortOn = $_POST["SortOn"];    
$SortIn = $_POST["SortIn"];


$sql = "SELECT ID, DateTime, FirstName, LastName, AdditionalInformation, Category1,    Category2, Category3, Category4, Category5, Pending, Approved, Disapproved, WebsiteName, WebsiteURL FROM 'websites' ORDER BY $SortOn $SortIn";
echo "<table border=\"1\"><tr><th>ID</th><th>Date & Time</th><th>First Name</th><th>Last Name</th><th>Additional Information</th><th>Category 1</th><th>Category 2</th><th>Category 3</th><th>Category 4</th><th>Category 5</th><th>Pending</th><th>Approved</th><th>Disapproved</th><th>Website Name</th><th>Website URL</th></tr>";

$result = mysql_query($sql);            



while ( $row = mysql_fetch_array($result))            
{                
    echo "<tr>";        
    for ( $column = 0;$column < count($row);$column++)        
    {            
        echo "<td>" . $row[$column] . "</td>";        
    }        
    echo "</tr>";    


}            
echo "</table>";

?>   

mysql_query returns a boolean false when an error occurs. So it looks like you have to fix your query. You can use mysql_error to figure out what the error is.

This variable $result gave you a boolean (probabily it will return a False or something like that, for tell you that query hasn't done a "good" execution) and not a resource as he expected.

So you have to use something like mysql_error() for retrive the cause and correct the above code.

Edit Take a look to your code, you miss a , in your order by fields

Make sure you have a valid database connection too. Try connect_db($host, $id, $pwd, $db) or die(mysql_error()). Also, use die in sql statement as suggested by others.