$boatbrands=$DB_site->query('select count(*) AS countboats, field6 as boatbrands FROM userfield WHERE field6 <> "n/a" AND field6 <> "n" AND field6 <> "none" AND field6 <> "NA" GROUP by field6 ORDER BY 1 DESC LIMIT 10'); while($boatbrand=$DB_site->fetch_array($boatbrands)) { // enter here your output orders/ template bits or something like that }