发出不同的价值观

I have some php code here that is supposed to show the unique/disctinct values from a field called 'Collections'. I have successfully connected to my database elsewhere. When this php code executes, the browser gives me an "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in mypage.php on line 20"

         $id = isset($_GET['id'])?(int)$_GET['id']:0; // if $_GET['id'] exists, return it as an integer, otherwise use a sentinel, id's usually start with 1, so 0 works

       if ($id!=0): 
// I assume this is a specific news item meaning you know it's ONE result
$query = 'SELECT * DISTINCT (Collections) FROM Audios LIMIT 40'; // so try to use limit     1, no need to add extra steps in the database lookup
    else: 
$query = 'SELECT * DISTINCT (Collections) FROM Audios ORDER BY Collections DESC LIMIT 40'; 
    endif;

   $result = mysql_query($query);
;
// now loop through the results ***(This is Line 20)***
while ($row = mysql_fetch_array($result)){
// and use'em however you wish
echo '

 <div>

  <li><a href="#">'.$row['Collections'].'</a></p>
</div>
 '; 
   }
SELECT  DISTINCT (Collections) FROM Audios ORDER BY Collections DESC LIMIT 40

Remove the * in both queries.