mysqli_query至少需要2个参数 [英] mysqli_query expects at least 2 parameters
本文介绍了mysqli_query至少需要2个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此mysqli_query
命令导致以下错误
mysqli_query("INSERT INTO `counter`.`hits` (`page_hits`) VALUES ('".$hits."')");
警告:mysqli_query()至少需要2个参数,其中1个是
Warning: mysqli_query() expects at least 2 parameters, 1 given in
此错误消息是什么意思,如何解决?
What does this error message mean, and how can it be fixed?
推荐答案
,您需要在页面的较早位置指定与数据库的连接.您应该将该变量放入查询中.假设您创建了一个名为$ con的变量.然后您的代码应该像这样.
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 ('".$hits."')");
这篇关于mysqli_query至少需要2个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文