This mysqli_query
command results in the error below
mysqli_query("INSERT INTO `counter`.`hits` (`page_hits`) VALUES (1)");
It seems you are confusing mysql_query with mysqli_query. The former accepts the sql statement as the first param, while the latter expects a link identifier (created by Mysqli::connect) as the first param and the statement as the second.
The two extensions are not compatable with each other. I suggest you pick one, read the manual pages on how to connect, execute queries, etc, and forget the other exists. which one you pick is up to you, mysqli is more feature rich but more complicated as a result.