PHP致命错误:未捕获的参数计数错误:mysqli_query()需要至少2个参数,1个在/includes/dbClass. php中给定[已关闭]

q1qsirdb  于 2022-12-02  发布在  PHP
关注(0)|答案(1)|浏览(320)

**已关闭。**此问题需要debugging details。当前不接受答案。

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
3天前关闭。
Improve this question
在网站中获取致命错误

[29-Nov-2022 17:57:22 Asia/Kolkata] PHP Warning:  Undefined array key 2 in /home2/greendly/public_html/includes/config.php on line 20
[29-Nov-2022 17:57:22 Asia/Kolkata] PHP Fatal error:  Uncaught ArgumentCountError: mysqli_query() expects at least 2 arguments, 1 given in /home2/greendly/public_html/includes/dbClass.php:115
Stack trace:
#0 /home2/greendly/public_html/includes/dbClass.php(115): mysqli_query('set names 'utf-...')
#1 /home2/greendly/public_html/includes/dbClass.php(99): dbClass->setCharset()
#2 /home2/greendly/public_html/includes/dbClass.php(80): dbClass->db_connect()
#3 /home2/greendly/public_html/includes/config.php(44): dbClass->__construct(Array)
#4 /home2/greendly/public_html/sadmin/header.php(2): include_once('/home2/greendly...')
#5 /home2/greendly/public_html/sadmin/register.php(7): include_once('/home2/greendly...')
#6 {main}
  thrown in /home2/greendly/public_html/includes/dbClass.php on line 115

请给予我解决这个致命错误的方法

dgtucam1

dgtucam11#

需要向mysql_query()传递两个参数;
请在此处查看https://www.php.net/manual/en/mysqli.query.php
另外,你的config.php中有一个未定义的数组键,要么设置它,要么检查它是否为set()-https://www.php.net/manual/en/function.isset.php

相关问题