Lets change up the whole thing here. Try this.
<?
require_once('Connections/test.php');
$sql = "SELECT company, sum(counter) AS hits
FROM hits
GROUP BY company";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)) {
echo $row['company']." ".$row['hits']."<br>";
}
?>
When you tried echoing $result, it is nothing more than a function (mysql_query), so it is telling you the resource id it used while performing that function. You need to fetch the results before you can echo them.