Click here to Skip to main content
14,870,616 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
include('dbcon.php');


if(isset($_POST['login']))
{
$username = $_POST['uname'];
$password = $_POST['pass'];
$qry="SELECT * FROM 'admin' WHERE 'username'='$username' AND 'password'='$password'";
$run=mysqli_query($con,$qry);
$row=mysqli_num_rows($run);
if($row<1)
{
?>

alert('username or password not match!!');
window.open('login.php','_self');

<?php
}
else
{
$data=mysqli_fetch_assoc($run);
$id=$data['id'];
echo "id = ".$id;

What I have tried:

include('dbcon.php');


if(isset($_POST['login']))
{
$username = $_POST['uname'];
$password = $_POST['pass'];
$qry="SELECT * FROM 'admin' WHERE 'username'='$username' AND 'password'='$password'";
$run=mysqli_query($con,$qry);
$row=mysqli_num_rows($run);
if($row<1)
{
?>

alert('username or password not match!!');
window.open('login.php','_self');

<?php
}
else
{
$data=mysqli_fetch_assoc($run);
$id=$data['id'];
echo "id = ".$id;
Posted
Updated 8-Jan-21 20:08pm
Comments

1 solution

MySQL commands return bool false on failure. Check the documentation for the failing command.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900