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)");
More Related Contents:
- Object of class mysqli_result could not be converted to string
- mysqli_stmt::bind_result(): Number of bind variables doesn’t match number of fields in prepared statement
- Strict Standards: mysqli_next_result() error with mysqli_multi_query
- Why does mysqli num_rows always return 0?
- mysqli::mysqli(): (HY000/2002): Can’t connect to local MySQL server through socket ‘MySQL’ (2)
- What is the difference between MySQL, MySQLi and PDO? [closed]
- parameters in MySQLi
- Retrieving Multiple Result sets with stored procedure in php/mysqli
- Mysql No connection could be made because the target machine actively refused it
- How to connect to MySQL database in PHP using mysqli extension?
- How do I count query result rows?
- Bind Param with array of parameters
- How do you use IN clauses with mysqli prepared statements [duplicate]
- What to do with mysqli problems? Errors like mysqli_fetch_array(): Argument #1 must be of type mysqli_result and such
- How to fetch all in assoc array from a prepared statement?
- Fatal error: Call to undefined function mysqli_result()
- Fatal error: Call to undefined method mysqli_stmt::fetch_array() [duplicate]
- Why I am getting an error when using w3school tutorial? [duplicate]
- Using wildcards in prepared statement
- mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it
- How to remove the fatal error when fetching an assoc array
- Fatal error: Call to undefined method mysqli_stmt::get_result()
- PHP MySQLi Multiple Inserts
- Fatal error: Call to a member function prepare() on a non-object in
- Which is fastest in PHP- MySQL or MySQLi?
- prepared parameterized query with PDO
- How to make mysqli connect function?
- Dynamically bind mysqli_stmt parameters and then bind result
- Check to see if an email is already in the database using prepared statements
- How to insert into MySQL using mysqli