ログインシステムの一部を具体的に処理する関数を構築しました。
これは私が撃墜されているエラーです:
警告: 105 行目の C:\xampp\htdocs\1\login.php で呼び出され、C:\xampp\htdocs\1\assets\includes\functions.php で定義されている dbclass::logcon() の引数 2 がありません10行目
これが問題のコードです
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 つの引数を渡しました。したがって、混乱は確かに手綱です。