I am using the below php code to fetch the data from the DB. I am unable to check if the Username matches with the entered password.
When correct Username and wrong password is entered, the app gets force closed.
Php code -
<?php
include 'DBConfig.php';
$con = mysqli_connect($HostName,$HostUser,$HostPass,$DatabaseName);
$json = file_get_contents('php://input');
$obj = json_decode($json,true);
$email = $obj['email'];
$password = $obj['password'];
$Sql_Query = "select * from UserRegistrationTable where email = '$email' and password = '$password'; ";
$connection_part = mysqli_query($con,$Sql_Query);
$dataExist=0;
if(mysqli_num_rows($connection_part)>0){
$SuccessLoginMsg = 'Data Matched';
$SuccessLoginJson = json_encode($SuccessLoginMsg);
echo $SuccessLoginJson ;
$check = mysqli_fetch_array($connection_part);
$response=array();
array_push($response,array("name"=>$check[1], "email"=>$check[2], "password"=>$check[3]);
echo json_encode(array("Details"=>$response));
}
else{
$InvalidMSG = 'Invalid Username or Password Please Try Again' ;
$InvalidMSGJSon = json_encode($InvalidMSG);
echo $InvalidMSGJSon ;
}
mysqli_close($con);
?>