mysqli_query expects at least 2 parameters

前端 未结 5 1039
旧时难觅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:40

    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.

提交回复
热议问题