can not login when i add login with mobile functionality php

43
October 11, 2018, at 5:40 PM

i have a login form in which user can login through mobile number or email or username now when i login through mobile number it works fine but when i login through username or email it says invalid how to make it works and when i remove the query for mobile login it works fine with username and email this is my php code

 $email = mysqli_real_escape_string($con,trim($_POST['email'])); 
  $password = mysqli_real_escape_string($con,md5(trim($_POST['password'])));
$query = "SELECT * FROM users WHERE (username='$email' or email = '$email' or mobile='$email')   AND password='$password' ";
$fire = mysqli_query($con,$query)or die(mysqli_error($con));
 if ($fire) {
if (mysqli_num_rows($fire) == 1) {

  $_SESSION['is_login'] = 'true';
  $_SESSION['email'] = $email;
  header("Location: dashboard");
}

how to solve this problem what am i doing wrong please help me and i wana do it with php only no javascript and ajax

Answer 1

actually i had email and username field in varchar but number field in big int i changed number field in varchar it solved the problem

READ ALSO
Not found nagios index page

Not found nagios index page

I have installed Nagios on server following manual: http://linuxcallingblogspot

31
CakePHP 3.6: fetchAll()with conditions

CakePHP 3.6: fetchAll()with conditions

I would like to add search functionality in my viewThe problem is that I get data from raw sql like this so I dont know how to filter the results:

18
echo not printing after form block [duplicate]

echo not printing after form block [duplicate]

This question already has an answer here:

10