Exactly what it says:
$sql is not a MySQL result resource.
When calling MySQL from within PHP, you have to do something similar to the following:
Code:
if($DBConnect = mysql_connect($DBHost, $DBName, $DBPass))
{
echo "Connected to MySQL";
if(mysql_select_db("aoafiles", $DBConnect))
{
echo "DB Selected";
$MyQuery = "add some kind of sql query here";
$QueryResult = mysql_query($MyQuery);
if($QueryResult !== false)
{
$count = mysql_num_rows($QueryResult);
}
}
else
echo "Unable to select DB";
}
else
echo "Connection failed";
Obviously, you have to define $DBHost, $DBName, and $DBPass as appropriate.
The error you are getting is typically the result of bad error checking on the part of the programmer; a query was executed that failed, but the programmer never checked the return code (in this case, the query result $sql, which will either be false or a mysql result resource).