Hi guys,

Can anyone possibly help me understand why the following query is producing:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

PHP Code:
<?

       include("../config.php");

// Connect to database
    $cid = mysql_connect($host,$username,$dbpass);
    if (!$cid) { echo("ERROR: " . mysql_error() . "\n");    }
    mysql_select_db("$db");



// define the maximum results to show (set in config file)
$max_results = $max_articles;


// Get the data from the Database
$query = "SELECT article_id, name, date from Articles LIMIT $max_results ORDER BY article_id DESC";

        $result = mysql_db_query($db,"$query",$cid);
        if (!$result) { echo("ERROR: " . mysql_error() . "\n$result\n");    }
    
    while($row=mysql_fetch_array($result)) 
    {
?>
    
<tr class="row-a">
<td class="first"><? echo("$row[date]"); ?></td>
<td><a href="article-<? echo("$row[article_id]"); ?>"><? echo("$row[name]"); ?></a></td>
</tr>


<?
    }  // end of while statement - getting results from DB
?>
Any help would be greatly appreciated