I am using php and mysqli for my web project but every thing seems to be fine but it gives me boolean error at mysqli_num_rows();
Note: the first line I echo so I can see whether the values I entered are being passed or not and it works fine still on the next line it gives me error Boolean.
<?php
include("Database/database.php");
session_start();
$uname = $_SESSION['un'];
$upassword = $_SESSION['up'];
$varch = $_SESSION['ch'];
$sql = "SELECT `username`, `userpwd`, `userid` FROM `useraccount` WHERE username = '$uname' AND userpwd = '$upassword'";
echo $sql;
$result = mysqli_query($link, $sql);
if($rowcount = mysqli_num_rows($result))
{
if($varch == "on")
{
setcookie("name", $uname, time()+60*60*7);
setcookie("password", $upassword, time()+60*60*7);
}
header('Location: useraccount.php');
}
?>
Aucun commentaire:
Enregistrer un commentaire