我已经构建了一个功能来专门处理我的部分登录系统。
这是我被击落的错误:
警告:缺少dbclass :: logcon()的参数2,在第105行的C:\ xampp \ htdocs \ 1 \ login.php中调用,并在C:\ xampp \ htdocs \ 1 \ assets \ includes \ functions中定义第10行的.php
这是有问题的代码
if (isset($_POST['submit'])) {
$user = $_POST['user'];
$password = $_POST['password'];
//To ensure that none of the fields are blank when submitting the form if
if (isset($_POST['user']) && isset($_POST['password'])) {
$user = stripslashes($user);
$password = stripslashes($password);
$db1 = new dbclass();
$db1->openDB();
$sql = "SELECT * FROM users WHERE username='{$user}' AND password='{$password}'";
$result = $db1->logcon($sql);
$row = mysqli_fetch_array($result);
最后,我的功能。
function logcon($user, $password) {
$esc_user = mysqli_real_escape_string($this->conn, $user);
$esc_password = mysqli_real_escape_string($this->conn, $password);
$sql = "select * all from users where username ='{$user}' AND password='{$password}";
$result = mysqli_query($this->conn, $sql);
if ($result) {
$numofrows = mysqli_affected_rows($this->conn);
return $numofrows;
} else
$this->error_msg = "could not connect!";
return false;
}
如你所见,我已经通过了2个论点。因此,混淆无疑。
答案 0 :(得分:0)
你得到了:
function logcon($user, $password )
但
$result=$db1->logcon($sql);