error sql mysqli_real_escape_string

selamat siang ,

mau nanya dong saya punya masalah error kaya gini :

Fatal error: Uncaught TypeError: mysqli_real_escape_string(): Argument #1 ($mysql) must be of type mysqli, string given in C:\xampp\htdocs\forum\admin\login.php:10 Stack trace: #0 C:\xampp\htdocs\forum\admin\login.php(10): mysqli_real_escape_string('dbforum', 'admin') #1 {main} thrown in C:\xampp\htdocs\forum\admin\login.php on line 10

minta solusi nya dong

<?php
    session_start();

	include '../functions/db.php';

	$uname = $_POST['uname'];
    $pwd = $_POST['pwd'];
	//$pwd = md5($password);

	$uname = mysqli_real_escape_string($db, $_POST['uname']);
    $pwd = mysqli_real_escape_string($db, $_POST['pwd']);

    $query = "SELECT * FROM tbladmin WHERE uname = '$uname' AND pwd = '$pwd'";
    $result = mysqli_query($query) or die ("Verification error");
    $array = mysqli_fetch_array($result);

    if ($array['uname'] == $uname){
        $_SESSION['uname'] = $uname;
        header("Location: home.php");
    }

    else{
    	echo '<script language="javascript">';
        echo 'alert("Incorrect username or password")';
        echo '</script>';
        echo '<meta http-equiv="refresh" content="0;url=index.php" />';
    }

?>
avatar g.a.r-
@g.a.r-

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Tanggapan

Script koneksi nya, bisa dilampirkan?

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban