Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in

om ini kenapa yah?

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Newfolder\login.php on line 13

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Newfolder\login.php on line 14

ini scripnya

 <form id="loginform" action="index.php?login_attempt=1" method="post">
<p class="animate4 bounceIn"><input type="text" id="username" name="username" placeholder="Username" /></p>
<p class="animate5 bounceIn"><input type="password" id="password" name="password" placeholder="Password" /></p>
<p class="animate6 bounceIn"><button class="btn btn-default btn-block">Masuk</button></p>

</form>
<?php
if(isset($_GET['login_attempt']))
{
$spf=sprintf("Select * from user_login where username='%s' and password='%s'",$_POST['username'],md5($_POST['password']));
$rs=mysqli_query($conn, $spf);
$rs=mysqli_query($conn, $spf);
$rw=mysqli_fetch_assoc($rs);
$rc=mysqli_num_rows($rs);

if($rc==1)
{
$_SESSION['login_hash']=$rw['login_hash'];
$_SESSION['login_user']=$rw['username'];
echo "<script>window.location='dashboard.php'</script>";
}
}
?>
avatar sambac
@sambac

5 Kontribusi 0 Poin

Diperbarui 6 tahun yang lalu

1 Jawaban:

coba echo $spf dan coba di run query nya di mysql nya langsung. Datanya ketemu ga.

avatar Nandar
@Nandar

648 Kontribusi 204 Poin

Dipost 6 tahun yang lalu

Login untuk ikut Jawaban