You need to specify the connection that you made to your database somewhere earlier in your page. You should put that variable in the query. Suppose you made a variable called $con
. Then your code should be like this.
mysqli_query($con,"INSERT INTO `counter`.`hits` (`page_hits`) VALUES (1)");