mysqli_query expects at least 2 parameters

前端 未结 5 1219
旧时难觅i
旧时难觅i 2020-11-21 06:53

This mysqli_query command results in the error below

mysqli_query("INSERT INTO `counter`.`hits` (`page_hits`) VALUES (1)"); 

5条回答
  •  天命终不由人
    2020-11-21 07:23

    From the manual

    Procedural style
    
    mixed mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
    

    You'll notice the $link and $query variables.

    This means that you need to pass the function a valid mysqli link resource as well as the query you wish to perform. This lets the function know which established connection to the server to use.

    A link resource can be created using:

    Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()

    and an example of how to do so can be found on the aforementioned manual page.

提交回复
热议问题