Don't use the @ symbol. It only suppresses errors, it does nothing to resolve them (in fact it makes them harder to resolve since it hides the error messages meaning you can't find where it went wrong).
What needs to be checked is that $db is properly being assigned to a mysql connection resource. One thing i notice is that your file I would assume is where mysql_connect is, is named bd.php not db. If $db is not assigned to something it will be null (hence the error). One that's null the query funtion fails to even execute because of invalid parameters, meaing $result will be undefined. Since its undefined, you get the second error as you end up passing null to mysql_fetch_array.
Note: The entire mysql extension is marked for deprecation and it is strongly suggested you use PDO or mysqli instead.