Fatal error: Uncaught TypeError: mysqli_num_rows(): line 11

<?php
session_start();
$_SESSION['sesi'] = NULL;

include "koneksi.php";
    if (isset($_POST['submit']))
    {
        $user   = isset($_POST['user']) ? $_POST['user'] : "";
        $pass   = isset($_POST['pass']) ? $_POST['pass'] : "";
        $qry    = mysqli_query($koneksi, "SELECT * FORM 'admin' WHERE 'username' = '$user' AND 'password' ='$pass'");
        $sesi   = mysqli_num_rows($qry);

        if ($sesi == 1)
        {
            $data_admin = mysqli_fetch_array($qry);
            $_SESSION['id_admin'] = $data_admin['id_admin'];
            $_SESSION['sesi'] = $data_admin['nm_admin'];

            echo "<script>alert('Anda berhasil Log In');</script>";
            echo "<meta http-equiv='refresh' content='0; url=index.php?user=$sesi'>";
        }
        else
        {
            echo "<meta http-equiv='refresh' content='0; url=login.php'>";
            echo "<script>alert('Anda Gagal Log In');</script>";
        }


    }
    else
    {
        include "login.php";
    }
?>
avatar ekaandreansyah
@ekaandreansyah

1 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

1 Jawaban:

Jawaban Terpilih

<pre>$qry = mysqli_query($koneksi, "SELECT * FORM 'admin' WHERE 'username' = '$user' AND 'password' ='$pass'");</pre><div>Ada typo dibagian "SELECT * FORM"<br>Seharusnya:&nbsp; "SELECT * FROM"<br><br></div><pre>$qry = mysqli_query($koneksi, "SELECT * FROM 'admin' WHERE 'username' = '$user' AND 'password' ='$pass'");</pre>

avatar Muhtasaq
@Muhtasaq

10 Kontribusi 6 Poin

Dipost 3 tahun yang lalu

Tanggapan

hehe thanks brother done

Login untuk ikut Jawaban