Does the count() function work on a D6 db_query object? I've never seen that done.
It might be simplest to just say
````php
$result = db_query($sql);
$row = db_fetch_array($result);
if (!$row) {
  return;
}
````