Postingan lainnya
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";
}
?>
0
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: "SELECT * FROM"<br><br></div><pre>$qry = mysqli_query($koneksi, "SELECT * FROM 'admin' WHERE 'username' = '$user' AND 'password' ='$pass'");</pre>
1
Tanggapan
hehe thanks brother done