I am getting the following error on my php script:

CODE:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/titles.php on line 42


This is line 42:


CODE:

Line 38  $sql = "select titleid from pages where sid=$catid";
Line 39   $result = mysql_query($sql ,$db);
Line 40         if ($result) {
Line 41
Line 42            if ($myrow = mysql_fetch_array($result)