PHP mysql loginreturns Email not found error even though it's in the database2019 Community Moderator ElectionHow do I quickly rename a MySQL database (change schema name)?What is the best collation to use for MySQL with PHP?How do I connect to a MySQL Database in Python?How do I get PHP errors to display?How to fix “Headers already sent” error in PHPHow to get the sizes of the tables of a MySQL database?Reference - What does this error mean in PHP?PHP no error detected but not showing properlyjquery ajax post doesn't workWhy is INSERT adding extra empty row below each query in mysql table?

Why would a jet engine that runs at temps excess of 2000°C burn when it crashes?

Do items de-spawn in Diablo?

Offered promotion but I'm leaving. Should I tell?

Why would one plane in this picture not have gear down yet?

What is the likely impact of grounding an entire aircraft series?

Solving "Resistance between two nodes on a grid" problem in Mathematica

Am I not good enough for you?

Time travel short story where dinosaur doesn't taste like chicken

What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?

Things to avoid when using voltage regulators?

Look through the portal of every day

How do I locate a classical quotation?

My story is written in English, but is set in my home country. What language should I use for the dialogue?

Should I tell my boss the work he did was worthless

Are babies of evil humanoid species inherently evil?

Peter's Strange Word

How much stiffer are 23c tires over 28c?

Algorithm to convert a fixed-length string to the smallest possible collision-free representation?

Good for you! in Russian

How much attack damage does the AC boost from a shield prevent on average?

Should I take out a loan for a friend to invest on my behalf?

How do you like my writing?

Aliens englobed the Solar System: will we notice?

Why does the negative sign arise in this thermodynamic relation?



PHP mysql loginreturns Email not found error even though it's in the database



2019 Community Moderator ElectionHow do I quickly rename a MySQL database (change schema name)?What is the best collation to use for MySQL with PHP?How do I connect to a MySQL Database in Python?How do I get PHP errors to display?How to fix “Headers already sent” error in PHPHow to get the sizes of the tables of a MySQL database?Reference - What does this error mean in PHP?PHP no error detected but not showing properlyjquery ajax post doesn't workWhy is INSERT adding extra empty row below each query in mysql table?










-2















I get this error when i try to login



Login email/password not found



however the login email and password is already in the MySql database and they have been entered correctly. I am trying to make a website to calculate the odds of winning different types of gambling games and I am going to store the data on the database for each individual user so that they can view it later.
Thanks



login.php



<?php 
include('header.html');
if (isset($errors)&& !empty($errors))

echo ' <p id="err_msg">Oops! there was a problem:<br>';
foreach ($errors as $msg )

echo " - $msg <br>";

echo 'Please try again or register <a href="register.php">here</a></p>';


?>
<form action="login_action.php" method="POST">
<dl>
<dt>Email : <input type="text" name="email"><dd>
<dt>Password: <input type="password" name="pass"><dd>
</dl>
<button type="submit">Login</button>
</form>


register.php



<?php
$page_title = 'GambCalc - Register';
include('header.html');
if ( $_SERVER['REQUEST_METHOD']=='POST')

require ('db_connection.php');
$errors = array();

if (empty($_POST['email']))
$errors[] = 'Enter your first name.' ;
else
$e = mysqli_real_escape_string($dbc,trim($_POST['email']));

if (empty($_POST['pass']))
$errors[] = 'Enter your password.' ;
else
$p = mysqli_real_escape_string($dbc,trim($_POST['pass']));

if (empty($errors))

$q = "SELECT user_id FROM users WHERE email='$e'";
$r = mysqli_query($dbc,$q);
if (mysqli_num_rows($r) != 0)
$errors[] = 'Email address already registered. <a href="login.php">Login</a>';


if (empty($errors))

$q = "INSERT INTO users (email, pass) VALUES ('$e',SHA1('$p'))";
$r = mysqli_query($dbc,$q);

if($r)

echo '<h1>Registered!</h1>
<p><a href="login.php">Login</a></p>';


mysqli_close($dbc);
exit();



else

echo '<h1>Error!</h1>
<p id="err_msg">The folloiwng error(s) occurred:<br>';
foreach($errors as $msg )

echo " - $msg<br>";


echo 'Please try again </p>';
mysqli_close($dbc);




?>

<h1>Register</h1>
<form action="register.php" method="POST">
<p>
Email address : <input type="text" name="email"
value="<?php if ( isset($_POST['email']))
echo $_POST['email'];?>">
</p>
<p>Password : <input type="password" name="pass" value="<?php if(isset($_POST['pass'])) echo $_POST['pass'];?>"></p>
<p><input type="submit" value="Register"></p>
</form>


login_tools.php



 <?php # LOGIN HELPER FUNCTIONS.

# Function to load specified or default URL.
function load( $page = 'login.php' )

# Begin URL with protocol, domain, and current directory.
$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . dirname( $_SERVER[ 'PHP_SELF' ] ) ;

# Remove trailing slashes then append page name to URL.
$url = rtrim( $url, '/\' ) ;
$url .= '/' . $page ;

# Execute redirect then quit.
header( "Location: $url" ) ;
exit() ;


# Function to check email address and password.
function validate( $dbc, $email = '', $pwd = '')

# Initialize errors array.
$errors = array() ;

# Check email field.
if ( empty( $email ) )
$errors[] = 'Enter your email address.' ;
else $e = mysqli_real_escape_string( $dbc, trim( $email ) ) ;

# Check password field.
if ( empty( $pwd ) )
$errors[] = 'Enter your password.' ;
else $p = mysqli_real_escape_string( $dbc, trim( $pwd ) ) ;

# On success retrieve user_id, first_name, and last name from 'users' database.
if ( empty( $errors ) )

$q = "SELECT user_id FROM users WHERE email='$e' AND pass=SHA1('$p')" ;
$r = mysqli_query ( $dbc, $q ) ;
if ( mysqli_num_rows( $r ) == 1 )

$row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ;
return array( true, $row ) ;

# Or on failure set error message.
else $errors[] = 'Email address and password not found.' ;

# On failure retrieve error message/s.
return array( false, $errors ) ;



login_action.php



if ( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' )

require ( 'db_connection.php' ) ;
require ( 'login_tools.php' ) ;
list ( $check, $data ) = validate ( $dbc, $_POST[ 'email' ], $_POST[ 'pass' ] ) ;
if ( $check )

session_start();
$_SESSION[ 'user_id' ] = $data[ 'user_id' ] ;
load('home.php');

else $errors = $data;
mysqli_close( $dbc ) ;

include ( 'login.php' ) ;
?>









share|improve this question









New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Where is the validate function? That seems like the most important thing.

    – Script47
    Mar 6 at 12:28












  • My apologies I added it now

    – bark
    Mar 7 at 14:06















-2















I get this error when i try to login



Login email/password not found



however the login email and password is already in the MySql database and they have been entered correctly. I am trying to make a website to calculate the odds of winning different types of gambling games and I am going to store the data on the database for each individual user so that they can view it later.
Thanks



login.php



<?php 
include('header.html');
if (isset($errors)&& !empty($errors))

echo ' <p id="err_msg">Oops! there was a problem:<br>';
foreach ($errors as $msg )

echo " - $msg <br>";

echo 'Please try again or register <a href="register.php">here</a></p>';


?>
<form action="login_action.php" method="POST">
<dl>
<dt>Email : <input type="text" name="email"><dd>
<dt>Password: <input type="password" name="pass"><dd>
</dl>
<button type="submit">Login</button>
</form>


register.php



<?php
$page_title = 'GambCalc - Register';
include('header.html');
if ( $_SERVER['REQUEST_METHOD']=='POST')

require ('db_connection.php');
$errors = array();

if (empty($_POST['email']))
$errors[] = 'Enter your first name.' ;
else
$e = mysqli_real_escape_string($dbc,trim($_POST['email']));

if (empty($_POST['pass']))
$errors[] = 'Enter your password.' ;
else
$p = mysqli_real_escape_string($dbc,trim($_POST['pass']));

if (empty($errors))

$q = "SELECT user_id FROM users WHERE email='$e'";
$r = mysqli_query($dbc,$q);
if (mysqli_num_rows($r) != 0)
$errors[] = 'Email address already registered. <a href="login.php">Login</a>';


if (empty($errors))

$q = "INSERT INTO users (email, pass) VALUES ('$e',SHA1('$p'))";
$r = mysqli_query($dbc,$q);

if($r)

echo '<h1>Registered!</h1>
<p><a href="login.php">Login</a></p>';


mysqli_close($dbc);
exit();



else

echo '<h1>Error!</h1>
<p id="err_msg">The folloiwng error(s) occurred:<br>';
foreach($errors as $msg )

echo " - $msg<br>";


echo 'Please try again </p>';
mysqli_close($dbc);




?>

<h1>Register</h1>
<form action="register.php" method="POST">
<p>
Email address : <input type="text" name="email"
value="<?php if ( isset($_POST['email']))
echo $_POST['email'];?>">
</p>
<p>Password : <input type="password" name="pass" value="<?php if(isset($_POST['pass'])) echo $_POST['pass'];?>"></p>
<p><input type="submit" value="Register"></p>
</form>


login_tools.php



 <?php # LOGIN HELPER FUNCTIONS.

# Function to load specified or default URL.
function load( $page = 'login.php' )

# Begin URL with protocol, domain, and current directory.
$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . dirname( $_SERVER[ 'PHP_SELF' ] ) ;

# Remove trailing slashes then append page name to URL.
$url = rtrim( $url, '/\' ) ;
$url .= '/' . $page ;

# Execute redirect then quit.
header( "Location: $url" ) ;
exit() ;


# Function to check email address and password.
function validate( $dbc, $email = '', $pwd = '')

# Initialize errors array.
$errors = array() ;

# Check email field.
if ( empty( $email ) )
$errors[] = 'Enter your email address.' ;
else $e = mysqli_real_escape_string( $dbc, trim( $email ) ) ;

# Check password field.
if ( empty( $pwd ) )
$errors[] = 'Enter your password.' ;
else $p = mysqli_real_escape_string( $dbc, trim( $pwd ) ) ;

# On success retrieve user_id, first_name, and last name from 'users' database.
if ( empty( $errors ) )

$q = "SELECT user_id FROM users WHERE email='$e' AND pass=SHA1('$p')" ;
$r = mysqli_query ( $dbc, $q ) ;
if ( mysqli_num_rows( $r ) == 1 )

$row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ;
return array( true, $row ) ;

# Or on failure set error message.
else $errors[] = 'Email address and password not found.' ;

# On failure retrieve error message/s.
return array( false, $errors ) ;



login_action.php



if ( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' )

require ( 'db_connection.php' ) ;
require ( 'login_tools.php' ) ;
list ( $check, $data ) = validate ( $dbc, $_POST[ 'email' ], $_POST[ 'pass' ] ) ;
if ( $check )

session_start();
$_SESSION[ 'user_id' ] = $data[ 'user_id' ] ;
load('home.php');

else $errors = $data;
mysqli_close( $dbc ) ;

include ( 'login.php' ) ;
?>









share|improve this question









New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Where is the validate function? That seems like the most important thing.

    – Script47
    Mar 6 at 12:28












  • My apologies I added it now

    – bark
    Mar 7 at 14:06













-2












-2








-2








I get this error when i try to login



Login email/password not found



however the login email and password is already in the MySql database and they have been entered correctly. I am trying to make a website to calculate the odds of winning different types of gambling games and I am going to store the data on the database for each individual user so that they can view it later.
Thanks



login.php



<?php 
include('header.html');
if (isset($errors)&& !empty($errors))

echo ' <p id="err_msg">Oops! there was a problem:<br>';
foreach ($errors as $msg )

echo " - $msg <br>";

echo 'Please try again or register <a href="register.php">here</a></p>';


?>
<form action="login_action.php" method="POST">
<dl>
<dt>Email : <input type="text" name="email"><dd>
<dt>Password: <input type="password" name="pass"><dd>
</dl>
<button type="submit">Login</button>
</form>


register.php



<?php
$page_title = 'GambCalc - Register';
include('header.html');
if ( $_SERVER['REQUEST_METHOD']=='POST')

require ('db_connection.php');
$errors = array();

if (empty($_POST['email']))
$errors[] = 'Enter your first name.' ;
else
$e = mysqli_real_escape_string($dbc,trim($_POST['email']));

if (empty($_POST['pass']))
$errors[] = 'Enter your password.' ;
else
$p = mysqli_real_escape_string($dbc,trim($_POST['pass']));

if (empty($errors))

$q = "SELECT user_id FROM users WHERE email='$e'";
$r = mysqli_query($dbc,$q);
if (mysqli_num_rows($r) != 0)
$errors[] = 'Email address already registered. <a href="login.php">Login</a>';


if (empty($errors))

$q = "INSERT INTO users (email, pass) VALUES ('$e',SHA1('$p'))";
$r = mysqli_query($dbc,$q);

if($r)

echo '<h1>Registered!</h1>
<p><a href="login.php">Login</a></p>';


mysqli_close($dbc);
exit();



else

echo '<h1>Error!</h1>
<p id="err_msg">The folloiwng error(s) occurred:<br>';
foreach($errors as $msg )

echo " - $msg<br>";


echo 'Please try again </p>';
mysqli_close($dbc);




?>

<h1>Register</h1>
<form action="register.php" method="POST">
<p>
Email address : <input type="text" name="email"
value="<?php if ( isset($_POST['email']))
echo $_POST['email'];?>">
</p>
<p>Password : <input type="password" name="pass" value="<?php if(isset($_POST['pass'])) echo $_POST['pass'];?>"></p>
<p><input type="submit" value="Register"></p>
</form>


login_tools.php



 <?php # LOGIN HELPER FUNCTIONS.

# Function to load specified or default URL.
function load( $page = 'login.php' )

# Begin URL with protocol, domain, and current directory.
$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . dirname( $_SERVER[ 'PHP_SELF' ] ) ;

# Remove trailing slashes then append page name to URL.
$url = rtrim( $url, '/\' ) ;
$url .= '/' . $page ;

# Execute redirect then quit.
header( "Location: $url" ) ;
exit() ;


# Function to check email address and password.
function validate( $dbc, $email = '', $pwd = '')

# Initialize errors array.
$errors = array() ;

# Check email field.
if ( empty( $email ) )
$errors[] = 'Enter your email address.' ;
else $e = mysqli_real_escape_string( $dbc, trim( $email ) ) ;

# Check password field.
if ( empty( $pwd ) )
$errors[] = 'Enter your password.' ;
else $p = mysqli_real_escape_string( $dbc, trim( $pwd ) ) ;

# On success retrieve user_id, first_name, and last name from 'users' database.
if ( empty( $errors ) )

$q = "SELECT user_id FROM users WHERE email='$e' AND pass=SHA1('$p')" ;
$r = mysqli_query ( $dbc, $q ) ;
if ( mysqli_num_rows( $r ) == 1 )

$row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ;
return array( true, $row ) ;

# Or on failure set error message.
else $errors[] = 'Email address and password not found.' ;

# On failure retrieve error message/s.
return array( false, $errors ) ;



login_action.php



if ( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' )

require ( 'db_connection.php' ) ;
require ( 'login_tools.php' ) ;
list ( $check, $data ) = validate ( $dbc, $_POST[ 'email' ], $_POST[ 'pass' ] ) ;
if ( $check )

session_start();
$_SESSION[ 'user_id' ] = $data[ 'user_id' ] ;
load('home.php');

else $errors = $data;
mysqli_close( $dbc ) ;

include ( 'login.php' ) ;
?>









share|improve this question









New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I get this error when i try to login



Login email/password not found



however the login email and password is already in the MySql database and they have been entered correctly. I am trying to make a website to calculate the odds of winning different types of gambling games and I am going to store the data on the database for each individual user so that they can view it later.
Thanks



login.php



<?php 
include('header.html');
if (isset($errors)&& !empty($errors))

echo ' <p id="err_msg">Oops! there was a problem:<br>';
foreach ($errors as $msg )

echo " - $msg <br>";

echo 'Please try again or register <a href="register.php">here</a></p>';


?>
<form action="login_action.php" method="POST">
<dl>
<dt>Email : <input type="text" name="email"><dd>
<dt>Password: <input type="password" name="pass"><dd>
</dl>
<button type="submit">Login</button>
</form>


register.php



<?php
$page_title = 'GambCalc - Register';
include('header.html');
if ( $_SERVER['REQUEST_METHOD']=='POST')

require ('db_connection.php');
$errors = array();

if (empty($_POST['email']))
$errors[] = 'Enter your first name.' ;
else
$e = mysqli_real_escape_string($dbc,trim($_POST['email']));

if (empty($_POST['pass']))
$errors[] = 'Enter your password.' ;
else
$p = mysqli_real_escape_string($dbc,trim($_POST['pass']));

if (empty($errors))

$q = "SELECT user_id FROM users WHERE email='$e'";
$r = mysqli_query($dbc,$q);
if (mysqli_num_rows($r) != 0)
$errors[] = 'Email address already registered. <a href="login.php">Login</a>';


if (empty($errors))

$q = "INSERT INTO users (email, pass) VALUES ('$e',SHA1('$p'))";
$r = mysqli_query($dbc,$q);

if($r)

echo '<h1>Registered!</h1>
<p><a href="login.php">Login</a></p>';


mysqli_close($dbc);
exit();



else

echo '<h1>Error!</h1>
<p id="err_msg">The folloiwng error(s) occurred:<br>';
foreach($errors as $msg )

echo " - $msg<br>";


echo 'Please try again </p>';
mysqli_close($dbc);




?>

<h1>Register</h1>
<form action="register.php" method="POST">
<p>
Email address : <input type="text" name="email"
value="<?php if ( isset($_POST['email']))
echo $_POST['email'];?>">
</p>
<p>Password : <input type="password" name="pass" value="<?php if(isset($_POST['pass'])) echo $_POST['pass'];?>"></p>
<p><input type="submit" value="Register"></p>
</form>


login_tools.php



 <?php # LOGIN HELPER FUNCTIONS.

# Function to load specified or default URL.
function load( $page = 'login.php' )

# Begin URL with protocol, domain, and current directory.
$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . dirname( $_SERVER[ 'PHP_SELF' ] ) ;

# Remove trailing slashes then append page name to URL.
$url = rtrim( $url, '/\' ) ;
$url .= '/' . $page ;

# Execute redirect then quit.
header( "Location: $url" ) ;
exit() ;


# Function to check email address and password.
function validate( $dbc, $email = '', $pwd = '')

# Initialize errors array.
$errors = array() ;

# Check email field.
if ( empty( $email ) )
$errors[] = 'Enter your email address.' ;
else $e = mysqli_real_escape_string( $dbc, trim( $email ) ) ;

# Check password field.
if ( empty( $pwd ) )
$errors[] = 'Enter your password.' ;
else $p = mysqli_real_escape_string( $dbc, trim( $pwd ) ) ;

# On success retrieve user_id, first_name, and last name from 'users' database.
if ( empty( $errors ) )

$q = "SELECT user_id FROM users WHERE email='$e' AND pass=SHA1('$p')" ;
$r = mysqli_query ( $dbc, $q ) ;
if ( mysqli_num_rows( $r ) == 1 )

$row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ;
return array( true, $row ) ;

# Or on failure set error message.
else $errors[] = 'Email address and password not found.' ;

# On failure retrieve error message/s.
return array( false, $errors ) ;



login_action.php



if ( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' )

require ( 'db_connection.php' ) ;
require ( 'login_tools.php' ) ;
list ( $check, $data ) = validate ( $dbc, $_POST[ 'email' ], $_POST[ 'pass' ] ) ;
if ( $check )

session_start();
$_SESSION[ 'user_id' ] = $data[ 'user_id' ] ;
load('home.php');

else $errors = $data;
mysqli_close( $dbc ) ;

include ( 'login.php' ) ;
?>






php mysql






share|improve this question









New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Mar 7 at 14:08







bark













New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 6 at 12:24









barkbark

11




11




New contributor




bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






bark is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Where is the validate function? That seems like the most important thing.

    – Script47
    Mar 6 at 12:28












  • My apologies I added it now

    – bark
    Mar 7 at 14:06

















  • Where is the validate function? That seems like the most important thing.

    – Script47
    Mar 6 at 12:28












  • My apologies I added it now

    – bark
    Mar 7 at 14:06
















Where is the validate function? That seems like the most important thing.

– Script47
Mar 6 at 12:28






Where is the validate function? That seems like the most important thing.

– Script47
Mar 6 at 12:28














My apologies I added it now

– bark
Mar 7 at 14:06





My apologies I added it now

– bark
Mar 7 at 14:06












2 Answers
2






active

oldest

votes


















1














Because in your query, it filtered the email with '$e' values. I think you should change it into something like this...



$q = "SELECT user_id FROM users WHERE email='".$e."'";


for checking, you can use var_dump or print_r



You should also update your other queries with the same format.



$q = "INSERT INTO users (email, pass) VALUES ('".$e."',SHA1('".$p."'))";





share|improve this answer






























    1














    Change your query to $q = "SELECT user_id FROM users WHERE email='".$e."'";






    share|improve this answer








    New contributor




    ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.



















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      bark is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023071%2fphp-mysql-loginreturns-email-not-found-error-even-though-its-in-the-database%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Because in your query, it filtered the email with '$e' values. I think you should change it into something like this...



      $q = "SELECT user_id FROM users WHERE email='".$e."'";


      for checking, you can use var_dump or print_r



      You should also update your other queries with the same format.



      $q = "INSERT INTO users (email, pass) VALUES ('".$e."',SHA1('".$p."'))";





      share|improve this answer



























        1














        Because in your query, it filtered the email with '$e' values. I think you should change it into something like this...



        $q = "SELECT user_id FROM users WHERE email='".$e."'";


        for checking, you can use var_dump or print_r



        You should also update your other queries with the same format.



        $q = "INSERT INTO users (email, pass) VALUES ('".$e."',SHA1('".$p."'))";





        share|improve this answer

























          1












          1








          1







          Because in your query, it filtered the email with '$e' values. I think you should change it into something like this...



          $q = "SELECT user_id FROM users WHERE email='".$e."'";


          for checking, you can use var_dump or print_r



          You should also update your other queries with the same format.



          $q = "INSERT INTO users (email, pass) VALUES ('".$e."',SHA1('".$p."'))";





          share|improve this answer













          Because in your query, it filtered the email with '$e' values. I think you should change it into something like this...



          $q = "SELECT user_id FROM users WHERE email='".$e."'";


          for checking, you can use var_dump or print_r



          You should also update your other queries with the same format.



          $q = "INSERT INTO users (email, pass) VALUES ('".$e."',SHA1('".$p."'))";






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 6 at 12:41









          jned29jned29

          332941




          332941























              1














              Change your query to $q = "SELECT user_id FROM users WHERE email='".$e."'";






              share|improve this answer








              New contributor




              ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                1














                Change your query to $q = "SELECT user_id FROM users WHERE email='".$e."'";






                share|improve this answer








                New contributor




                ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                  1












                  1








                  1







                  Change your query to $q = "SELECT user_id FROM users WHERE email='".$e."'";






                  share|improve this answer








                  New contributor




                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Change your query to $q = "SELECT user_id FROM users WHERE email='".$e."'";







                  share|improve this answer








                  New contributor




                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered Mar 7 at 7:41









                  ddex20ddex20

                  213




                  213




                  New contributor




                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  ddex20 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.




















                      bark is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      bark is a new contributor. Be nice, and check out our Code of Conduct.












                      bark is a new contributor. Be nice, and check out our Code of Conduct.











                      bark is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023071%2fphp-mysql-loginreturns-email-not-found-error-even-though-its-in-the-database%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

                      Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                      List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229